The past year has been one wave of turbulence after another with the stock market. And most investors are tired of all the uncertainty.

The bad news is there could be more volatility on the horizon. There's now a greater than 50% chance that we'll face a recession in 2023, according to analysts from JPMorgan Chase, and the stock market could take another fall this year.

But there's good news, too. One stock market indicator has been correct 100% of the time over the past century, and it can give investors plenty of reasons to be optimistic about the future.

Where will the stock market be in 20 years?

It's easy to get caught up in the market's short-term fluctuations. But they aren't nearly as important as its long-term potential. Fortunately, the market's long-term outlook is incredibly promising for investors.

Data and analytics firm Crestmont Research examined the rolling 20-year total returns of the S&P 500 beginning in 1900. Researchers looked at data from 104 years, from 1919 to 2022, to determine which of those 20-year periods saw positive total returns.

They found that regardless of what was happening with the stock market in those periods, the S&P 500 earned positive 20-year total returns 100% of the time. In other words, you could have invested in an S&P 500 index fund at any point after 1900, and as long as you held it for 20 years, you would have earned positive total returns.

Over the last two decades, we've experienced some of the worst downturns in history -- from the dot-com meltdown to the Great Recession to the COVID-19 crash and now the current slump.

^SPX Chart

^SPX data by YCharts.

Despite everything, though, the S&P 500 remained up by more than 180% in that time. If you had invested in an S&P 500 index fund in January 2000, your investments would have not only survived, but you'd also have nearly tripled your money by now.

What should you do right now?

While it's often easier said than done, perhaps the best thing you can do right now is avoid getting caught up in the short-term ups and downs and, instead, keep a long-term outlook. The market may face more volatility in the coming months, but that doesn't necessarily matter to long-term investors. If history shows us anything, it's that no matter how bad things get in the near term, the future is still bright.

It's also critical, though, to ensure your portfolio is up to par. Weak companies may not survive a recession, so now is the time to double-check that you're only investing in stocks from healthy businesses with the potential for long-term growth.

When in doubt, you may opt for an S&P 500-tracking fund, such as the Vanguard S&P 500 ETF or iShares Core S&P 500 ETF.

These funds mirror the performance of the S&P 500 itself. Because the index has a perfect track record of recovering from downturns and earning positive returns over decades, this type of investment is almost guaranteed to make money over time.

If you're feeling nervous about the stock market's future, that's normal. But history shows that the S&P 500 is incredibly resilient and can recover from just about anything. By sticking it out for the long haul, you can rest easier knowing your money is safer.