Over the past 12 months, the S&P 500 and Nasdaq have risen about 25% and 35%, respectively. Both indexes are hovering near record highs and trading at historically high valuations, even amid inflation, geopolitical conflicts, and other fierce macro headwinds.
Therefore, investors might be wondering if it's smarter to lock in their gains before the summer or simply let their winners ride over the next few years. Let's review the key catalysts that propelled the indexes to their all-time highs -- and if that momentum will last.
Image source: Getty Images.
Why did U.S. stocks soar?
The rapid growth of the artificial intelligence (AI) market -- which generated tailwinds for the cloud infrastructure, data center, chipmaking, networking, and energy markets -- drove many of those top stocks to their record highs over the past year. Those hot stocks included Nvidia (NVDA +2.65%), Broadcom, and Alphabet -- which all easily outperformed the S&P 500 and Nasdaq.

NASDAQ: NVDA
Key Data Points
The growth of those tech giants offset the weaker growth of companies that were more exposed to soaring oil prices, inflation, and geopolitical conflicts. At the same time, rising oil prices drove big oil stocks higher, while soaring energy demand from power-hungry AI and data center markets drove the bulls toward a broader range of energy and electrification stocks.
Should you "sell in May and go away"?
Some investors might think it's smarter to "sell in May and go away" in this frothy market. However, those who followed that mantra left a lot of money on the table over the long term.
While May has a reputation as a bad month for stocks (because investors habitually lock in profits before the summer), it's a short-term seasonal trend. Over the past ten years, the S&P 500 and Nasdaq have risen about 260% and 430%, respectively -- even as the pandemic, inflation, soaring inflation rates, and military conflicts rattled the global economy.
Past performance never guarantees future gains, but the main sectors driving the market's rally are still firing on all cylinders. The AI, data center, and energy markets won't cool off anytime soon, and that secular expansion will drive those stocks higher -- even if the market's non-AI stocks fizzle out. So if you plan to hold your stocks for at least a few more years, there's no reason to "lock in" your gains before the summer. Instead, you should simply tune out the near-term noise and have some faith in your top-performing investments.





