The stock market has been on a wild ride of ups and downs over the past year, and all three major market indexes -- the S&P 500, the Nasdaq, and the Dow Jones Industrial Average -- have dipped into bear market territory at some point.

Many investors are also concerned that a recession is still on the horizon, and stock prices could have further to fall.

While nobody knows for certain what the future holds for the market, there's one move I made during this bear market that I'll continue even if we face a recession: I've kept a long-term outlook.

Silver bear and bull figurines facing each other.

Image source: Getty Images.

A long-term outlook is key to thriving in the stock market

In the short term, the stock market can be volatile. The market will always have its bad days even in good economic times, and those fluctuations can be nerve-racking.

Over the long haul, though, it's incredibly consistent. Despite major recessions, crashes, bear markets, and other significant events, the market has not only survived but thrived.

In the past two decades alone, the S&P 500 has experienced some of the worst downturns in history -- from the dot-com bubble burst to the Great Recession to the crash in the early stages of the COVID-19 pandemic. However, it's still up by more than 170% since 2000.

^SPX Chart

^SPX data by YCharts.

This is a consistent theme throughout history, too. Data and analytics firm Crestmont Research analyzed the performance of the S&P 500 over the past century, looking at its rolling 20-year total returns every year since 1900.

Researchers found that in every single year examined (from 1919 to 2022), the S&P 500 earned positive total returns.

In other words, if you had invested in an S&P 500 index fund or exchange-traded fund (ETF) at any point after 1900 and just held that investment for 20 years, you'd have earned positive total returns regardless of all the downturns the market experienced in that time.

A bull market is coming

We may not know how the market will perform over the coming weeks or months, but it's extremely likely it will thrive over decades. No bear market lasts forever, so it's only a matter of time before the next bull market begins.

The best way to take advantage of that bull market is to invest during the market's low points, then hold those investments for the long term. By investing now, you can snag high-quality stocks at lower prices. Then, when the market inevitably rebounds, you could see substantial returns.

The key, though, is to invest in the right places. Not all stocks are strong enough to survive a bear market or recession, and if your portfolio is shaky, it may not make it until the rebound period.

Strong stocks with solid underlying business fundamentals are far more likely to see long-term growth, however. By loading up on these investments, you'll be in a fantastic position to experience potentially lucrative earnings during the next bull market -- whenever that may happen.

Protecting your investments

It's an unnerving time to be an investor. The past year has been rocky, and there could be more volatility on the horizon.

However, a long-term outlook can make this slump more bearable. By investing in quality stocks and holding them for years, it's much easier to protect your investments and maximize your earnings over time.