The S&P 500 (^GSPC 0.80%) hit a new all-time high on Jan. 19 this year. Since then, the stock market has continued to climb, and the index currently trades near its all-time high. That may leave many investors wondering if they should wait for a pullback before putting more money into the market.

It's perfectly natural to want to get a better price on your investments. Few feelings are worse than putting money into an investment and watching it immediately decline in value. And since every bear market has to start at an all-time high, by definition, it feels like that could easily happen if you invest today.

While it might feel like stocks could only go down from here, history suggests now may be a great time to invest.

A woman at a desk looking at a computer screen while holding glasses.

Image source: Getty Images.

Here's what happens after stocks hit a new all-time high

Everyone understands that stocks, as a group, increase in value over time. That means stocks must hit new all-time highs over and over again. So, hitting one all-time high usually leads to many more all-time highs.

In 1995, for example, the S&P 500 recorded 77 all-time highs. That's nearly one out of every three trading days that year. Since hitting a new intraday high on Jan. 19, the S&P 500 has recorded 19 more all-time highs.

The average returns after stocks reach new all-time highs are also higher than the overall average returns for the S&P 500. Since 1950, the S&P 500 total return one year after reaching a new all-time high was 12.7% versus 12.4% for other 12-month periods, according to research from Fidelity. If you invested when the index makes a new high exiting a bear market, you'd see an average return of 14%.

The S&P 500 currently sits less than 8% above the Jan. 19 high. So, the historic averages suggest there's still plenty of upside left over the next few months.

If you look longer term, investing right now is even more appealing. Investing the day stocks hit an all-time high between 1988 and 2020 led to a total return of 50.4% after three years and 78.9% after five years, according to data compiled by JPMorgan. That's far better than the 39.1% three-year and 71.4% five-year total returns the S&P 500 provided on average during that period.

So, investing when stocks reach a new all-time high is usually a better bet than average for stocks.

The best way to invest when the market hits an all-time high

When the stock market hits a new all-time high it may feel as though many stock valuations are stretched well above their intrinsic value. Finding an individual stock to buy can be a lot more difficult than when we're nearing the bottom of a bear market. Still, there are always opportunities to invest your money. Even a fair price on a great company can beat the overall market long term.

That said, it's hard to go wrong investing in a broad-based index fund like the Vanguard S&P 500 ETF (VOO 0.87%). The index tracks the S&P 500 closely and has one of the lowest expense ratios in the industry. If history repeats itself, or at least rhymes, as it's wont to do, you'll very likely experience good returns over the next few years.

That said, the S&P 500 has become increasingly concentrated over the last few years. The growth of the "Magnificent Seven" stocks has pushed the top 10 components of the S&P 500 to account for over one-third of the index's value. That's a level we haven't seen in decades.

What's more, the valuations of those megacap stocks is much higher than the rest of the S&P 500 index. Stripping just eight of the largest companies from the index takes the S&P 500 forward P/E ratio from 19.7 to 17.4, according to Yardeni Research.

That may mean investors can find better opportunities by focusing on smaller businesses in the index. One way to invest more in the other 492 companies in the S&P 500 is to buy the Invesco S&P 500 Equal Weight ETF (RSP 1.33%). The index fund equally weights the stocks in the S&P 500 index, rebalancing once per quarter. That means you'll invest just as much in the bottom 10 as the top 10. The equal weight index has historically outperformed the standard S&P 500 index, despite the strong run of megacap stocks over the past decade.

However you decide to invest -- individual stocks, a standard index fund, or a fund skewed toward smaller companies -- buying stocks at an all-time high can still be a great way to grow your wealth. Even if you've sat on the sidelines watching stocks continuously set new highs this year, it's not too late to jump in.