The S&P 500 (^GSPC -0.01%) crashed in early April, when President Trump outlined a shockingly severe slate of tariffs that Morningstar strategist Preston Caldwell called "a self-inflicted economic catastrophe." But the president has since soften his stance on trade policy to some degree, and the index has rebounded to record highs.
The S&P 500 climbed 6.2% in May, 5% in June, and 2.2% in July, marking the sixteenth time since 1950 the index has notched consecutive gains in those three months. What makes that particularly noteworthy is the popular maxim that warns investors to "sell in May and go away."
Those who took that advice this year missed substantial upside, and they may continue to miss out if they stay out of the stock market. The S&P 500 has usually notched double-digit returns in the year following incidents where it gained ground in May, June, and July.

Image source: Getty Images.
History says the S&P 500 will achieve double-digit gains in the next 12 months
The S&P 500 is widely considered the best benchmark for the overall U.S. stock market. The index was created in 1957, but the selection methodology can be applied to earlier years to generate hypothetical back-tested values.
The S&P 500 has only produced positive returns in May, June, and July during 16 years since 1950, according to Carson Investment Research. And that mid-year momentum led to more upside in the next year in 14 of 16 occasions, with the S&P 500 returning an average of 13.5% during the 12 months following back-to-back-to-back gains in May, June, and July.
We can use that information to make an educated guess about how the stock market might perform in the future. The S&P 500 closed at 6,339 on July 31. The index will advance 13.5% to 7,195 by July 31, 2026, if its performance aligns with the historical average. That implies nearly 12% upside from its current level of 6,450.
Of course, past performance are never a guarantee of future returns, but Wall Street has a similar take on the situation. The median target price on every stock in the index suggests the S&P 500 will reach 7,148 in the next 12 months, according to FactSet Research. That implies nearly 11% upside from its current level.
Elevated valuations and tariffs could spell trouble for the stock market
The S&P 500 trades at 22.9 times forward earnings, a premium to the 10-year average of 18.5 times forward earnings. Such an expensive valuation has historically coincided with poor future results. The S&P 500 has declined by an average of 6.4% during the year after its valuation hit 22 times forward earnings, according to money manager Leon Cooperman.
Investors should be particularly cautious in the current market environment, because tariffs imposed by the Trump administration are an unknown variable. Most economists expect a slowdown in gross domestic product (GDP) growth as higher prices curb spending among consumers and businesses. But the tariffs are unprecedented in recent history, raising the average tax on U.S. imports to its highest level since the 1930s, so predicting the outcome is impossible.
In a good scenario, tariffs may have a negligible impact on GDP, and the additional revenue they generate could reduce the government's need to borrow money. That would probably lead to lower Treasury yields, making stocks look more attractive than bonds by comparison. But in a bad scenario, tariffs could drag the economy into a recession, in which case history says the S&P 500 would decline sharply.
Lisa Shalett, Chief Investment Officer at Morgan Stanley, recently wrote, "Bullish investors are shrugging off tariff risks, but lingering uncertainties on trade and inflation warrant caution." Keep those sobering words in mind as you make decisions with your money.