The hottest stocks of July

Despite a stock market full of fear about Greece, the Fed and the upcoming earnings season, July may provide a midsummer respite from the recent downside volatility.

It could shape up to be a positive month, if trends in the market over the last 10 years repeat themselves.

According to market data and analytics firm Kensho, during that time span the month of July has averaged stock market gains across the major U.S. indexes.

Read MoreHere's where stocks are heading in the second half

Not only are there average gains for the S&P 500, Dow industrials and Nasdaq composite, all three post positive returns at least 60 percent of the time.

Trader on the floor of the New York Stock Exchange.
Getty Images
Trader on the floor of the New York Stock Exchange.

Leading the way is the Nasdaq composite, which averages a 2.1 percent gain for the month, and has posted a positive return in six of the last 10 years. The S&P 500 averaged a 1.6 percent rise and has also been positive in six of the last 10 years.

The crown for batting average, however, goes to the Dow Jones industrial average, which has posted a positive July return in seven of the last 10 years. The average gain during that time span was 1.9 percent.

Read MoreStocks in the first half offer a very mixed bag

The broader market strength also plays out in all 10 sectors of the S&P 500 index. During the last decade, the month of July has led to average gains across all of them. Some fare better than others.

Oil prices appear to have stabilized for the time being, and that may help energy stocks continue their bullish July trend. The sector has posted positive returns in eight of the last 10 years, and the average gain was 1.4 percent.

Technology, the largest sector of the S&P 500, posts a more impressive 2.4 percent average gain, but has been positive in seven of the last 10 years. Meanwhile utility stocks post the smallest average gain for July on average, at 0.5 percent, and have been positive in six of the last 10 years. Materials stocks have turned in a negative performance more often not over that time span.

Name Average % Return # of Trades % of Trades Positive
S&P 500 Energy Sector 1.40% 10 80%
S&P 500 Information Technology Sector 2.40% 10 70%
S&P 500 Health Care Sector 1.90% 10 70%
S&P 500 Consumer Staples Sector 1.90% 10 70%
S&P 500 Financials Sector 1.70% 10 70%
S&P 500 Industrials Sector 1.40% 10 70%
S&P 500 Index 1.60% 10 60%
S&P 500 Telecommunication Services Sector 0.90% 10 60%
S&P 500 Utilities Sector 0.50% 10 60%
S&P 500 Consumer Discretionary Sector 1.50% 10 50%
S&P 500 Materials Sector 1.80% 10 40%
Source: Kensho

As for individual stock standouts, there are a handful that have had a strong positive track record during that time. There are 457 members of the S&P 500 that have been around for at least the last 10 years, and among those, only 12 companies have posted positive returns in July in at least nine of that month's past trading periods.

Consumer electronics giant Apple makes the list, posting an average July return of 9 percent. Alexion Pharmaceuticals owns the biggest average July return, nearly 13 percent. However, only one stock in the entire S&P 500 has been positive every July for the past 10 years. That distinction belongs to Big Blue. IBM has not had a losing July in the last decade, and its average gain is nearly 6 percent.

Read MoreStocks at inflection point as second quarter ends

Symbol Name Average Percent Return Number of Trades Percent of Trades Positive
IBM International Business Machines Corp. 5.70% 10 100%
ALXN Alexion Pharmaceuticals 12.80% 10 90%
CELG Celgene Corp. 9.90% 10 90%
AAPL Apple Inc. 9.00% 10 90%
SNA Snap-On Inc. 6.10% 10 90%
BXP Boston Properties 4.60% 10 90%
AVB Avalonbay Communities 4.50% 10 90%
ESS Essex Property Trust 4.30% 10 90%
GS Goldman Sachs Group 4.10% 10 90%
PSA Public Storage 3.70% 10 90%
SPG Simon Property Group 3.60% 10 90%
ESRX Express Scripts 3.30% 10 90%
Source: Kensho

While there's no doubt there will be plenty of downside catalysts for the stock market to contend with, bulls may find a little more courage to stay invested during the month of July, if performance trends over the last 10 years continue this time around.

As many experts will point out, past performance does not necessarily predict future performance. With Greek headlines sure to dominate during the month of July, those trends may have a tough uphill climb in 2015.

—CNBC's Gina Francolla, Cara Caruso and Christopher Hayes contributed to this report.

Disclosure: NBCUniversal, parent of CNBC, is a minority investor in Kensho.