What a difference a year makes! In 2021, the worst decline investors endured was a menial 5% swoon in the benchmark S&P 500 (^GSPC -0.30%). This year, the S&P 500 has entrenched itself in a bear market, with a peak-to-trough decline of 28%. What's more, it produced its worst first-half return since Richard Nixon was president.

Other widely followed indexes have fared poorly, too. The timeless Dow Jones Industrial Average (^DJI -0.35%) briefly entered a bear market with a peak 22% decline, while the tech-driven Nasdaq Composite (^IXIC -0.25%) has plummeted as much as 38% from one year ago.

A twenty dollar bill paper airplane that's crashed and crumpled into a financial newspaper with visible stock quotes.

Image source: Getty Images.

The $64,000 question: Where will the stock market bottom out?

Both the uncertainty and velocity of downside moves during bear markets can play on the emotions of investors and coerce rash decision-making. It's what has new and tenured investors alike wondering when and where the stock market will bottom out.

To be perfectly blunt, if there were a foolproof indicator that accurately forecast when bear markets will occur, how long the drop will last, and where the bottom would be, every investor on the planet would be using it by now. Because catalysts differ for every stock market decline, and investor emotions/reactions are never precisely the same to these declines, there's simply no concrete way to know in advance when or where the stock market will bottom out.

But that doesn't mean there aren't indicators that have exceptionally successful track records of guiding the investment community in the right direction.

Over the past couple of months, I've looked at a number of metrics that offer a lengthy history of (fairly) accurately predicting when bear markets will occur, how steep the decline will be, or when/where the stock market will bottom out. This includes everything from valuation-based indicators to traditional metrics like outstanding margin debt. I even recently offered a correlation between Federal Reserve monetary policy and stock market bottoms.

But there's yet another way to forecast stock market bottoms: sentiment-based indicators.

A visibly concerned person looking at a plunging stock chart displayed on a computer monitor.

Image source: Getty Images.

This investor sentiment measure has historically been an excellent buy signal

While there are plenty of metrics and gauges that are designed to measure how greedy or fearful investors feel at any given moment, a technical indicator could prove far more useful at identifying prime buying opportunities. Specifically, I'm talking about the percentage of S&P 500 stocks trading above their respective 200-day moving average.

Moving averages are a technical analysis staple that average the share price of a company over a defined period. The assumption being that moving averages will provide some level of support or resistance, depending on what side of the moving average line a stock finds itself on.

But moving averages by themselves aren't particularly useful. They tell us nothing about what makes a company tick or what catalysts are in its future. Moving averages can, however, provide an accurate look at investor sentiment.

Throughout history, investors have made it a habit of shooting valuations too far to the upside during bull markets and becoming too pessimistic during bear markets. By examining the percentage of S&P 500 stocks above their 200-day moving average and comparing that figure to historic figures, we can identify moments where investors overshot to the upside or downside.

At the moment, 37.6% of the roughly 500 companies that comprise the S&P 500 are trading above their 200-day moving average. That's not a particularly telling figure one way or the other. However, since the beginning of 2002, there have been a dozen instances where the percentage of S&P 500 stocks above their 200-day moving average fell below 18%. Each of these instances has represented an incredible buying opportunity. 

But there is a caveat to this investor sentiment indicator: it's not for short-term traders. Just because investor sentiment is poor, it doesn't mean it can't get worse.

During the depths of the Great Recession in 2009, the percentage of S&P 500 stocks above their 200-day moving average didn't bottom out till it hit just 1%! In other words, this isn't an indicator that'll precisely tell you when a bear market bottom will occur. Rather, it offers a successful history of accurately forecasting the approximate bottom of the most widely followed stock market index by alerting investors to overly negative investor sentiment.

History is on the side of long-term investors

But this isn't the only metric that can put some pep in investor's step. Historically speaking, every sizable stock market decline has represented a surefire buying opportunity for long-term investors.

According to sell-side consultancy firm Yardeni Research, the S&P 500 has declined by at least 10% on 39 separate occasions over the past 72 years. In short, stock market corrections, and even bear markets, are probably more common than you realize. Yet in each of these instances (save for the current bear market), a bull market rally eventually recouped all that was lost. Given time, "this too shall pass" will prove right, once more.

To take things a step further, data has shown that the S&P 500 has never let investors down if they're willing to buy and hold a tracking index for 20 years. Based on data published by market analytics company Crestmont Research, the rolling 20-year total return, including dividends paid, for the S&P 500 since 1900 has never been negative.  In plain English, it means that no matter when you bought an S&P 500 tracking index since the beginning of 1900, you walked away richer as long as you held for 20 years. This means now is as good a time as any for patient investors to put their money to work on Wall Street.