The S&P 500 has been steadily climbing from its lowest point in October 2022. Now that it's reached a new all-time high, it's official by all standards that we're in a fresh bull market.

While many investors are feeling optimistic about the market right now, it can also be a nerve-wracking time to invest. The S&P 500 has already surged by more than 38% from its low point in 2022, and some people are worried that the best time to buy has already come and gone.

Some are also concerned that this is only a temporary rally before stock prices dip again. If that happens, investing now could mean buying at the worst possible moment while the market is high.

However, while the future of the market is uncertain, one of the worst mistakes you can make right now is to wait too long to invest. Here's why.

Bull and bear facing each other.

Image source: Getty Images.

Why waiting to buy could hurt your long-term earnings

Nobody knows where the market is headed over the coming weeks or months, which can be daunting. But the good news is that the stock market's long-term track record is impeccable.

Throughout history, there's never been a bad time to invest in the stock market -- as long as you're willing to hold your investments for at least a few years. Despite experiencing severe recessions, bear markets, and crashes, the stock market has managed to recover from every single one.

Time is your most valuable asset when building wealth in the stock market, and the more time you give your investments to grow, the more you can potentially earn. Even if you invest at a "bad" time, you could still earn more over the long haul than if you were to wait until a "safer" moment to invest.

For example, say you had invested in an S&P 500 index fund in January 2010. The market had been in bull market territory for close to a year at that point after the Great Recession, but there were still some short-term hurdles on the horizon. By today, though, you'd have earned total returns of more than 343%.

^SPX Chart

^SPX data by YCharts.

On the other hand, say you waited until January 2014 to invest. At that point, the S&P 500 had been consistently on the rise, with few speed bumps along the way. That may have seemed like a safer time to buy, yet you'd only have earned total returns of around 167% by today.

^SPX Chart

^SPX data by YCharts.

While it can sound contradictory, waiting until it's "safe" to invest can severely limit your earnings. Volatility can be unnerving, but it's normal for the market. Rather than waiting for the market to stabilize, it's often best to invest now and give your money as much time as possible to grow.

One important caveat

By holding your investments for the long term, you can ride out any periods of volatility and maximize your earnings over time. That said, it's crucial to invest in the right places.

Not all investments will be able to recover from downturns. Stocks from companies with shaky fundamentals -- such as weak finances or no competitive advantage in the industry -- could fall hard during market slumps and struggle to bounce back.

Strong companies with healthy fundamentals, though, are much more likely to rebound. They'll still often take a hit during periods of volatility but have a much better chance of seeing positive long-term returns. By filling your portfolio with these types of stocks, you can rest easier knowing you're as protected as possible against market turbulence.

This bull market is a fantastic opportunity to build wealth in the stock market, especially if stock prices continue to soar. By investing in the right places and getting started sooner rather than later, you can set yourself up for potentially substantial long-term gains.