The S&P 500 (^GSPC 1.02%) has rebounded sharply from its bear-market lows, and the broad-based index is now within 6% of its all-time high, putting it on the cusp of a new bull market. But Warren Buffett famously warned investors to "be fearful when others are greedy," and that advice is particularly relevant now.

A stock market indicator known as the CNN Business Fear & Greed Index currently signals extreme greed, which hints at a possible decline in share prices in the near term. In other words, the S&P 500 may linger in bear-market territory for a little while longer.

Here's what investors should know.

A bear figurine roaring in front of a downward-sloping stock price chart.

Image source: Getty Images.

How the Fear & Greed Index works

CNN Business developed the Fear & Greed Index to help investors gauge market sentiment and assess whether stocks are fairly priced. In theory, fear drags stock prices lower and greed drives stock prices higher, sometimes to the point where they are undervalued or overvalued, respectively.

The Fear & Greed Index blends seven technical indicators to produce a score ranging from 0 to 100, where 0 represents maximum fear and 100 represents maximum greed. The seven parameters are explained below.

Market momentum: This indicator compares the S&P 500 to its 125-day moving average. The S&P 500 is currently well above that threshold, signaling greed.

Stock price strength: This indicator looks exclusively at the New York Stock Exchange, comparing the number of stocks at 52-week highs and 52-week lows. Stock are currently skewed toward 52-week highs, signaling greed.

Stock price breadth: This indicator also looks exclusively at the New York Stock Exchange, comparing the volume of shares rising in value against the volume of shares falling in value. Trading volume in rising stocks exceeds trading volume in falling stocks at the present time, signaling greed.

Put and call options: This metric measures the average ratio of put options (contracts that give investors the right to sell at a certain price) to call options (contracts that give investors the right to buy at a certain price) over the last five days. The ratio of puts to calls is currently falling, signaling greed.

Market volatility: This indicator compares the CBOE Volatility Index (VIX) to its 50-day moving average. The VIX is currently in line with that threshold, meaning market volatility is holding steady, which is a neutral signal.

Safe haven demand: This metric compares stock returns (riskier investments) to Treasury Bond returns (safer investments) over the last 20 days. Stocks have outperformed bonds during that time, signaling greed.

Junk bond demand: This indicator measures the yield spread between junk bonds (riskier bonds) and investment-grade bonds (safer bonds) with the assumption that a larger differential indicates fear. The yield spread between junk bonds and investment-grade bonds is relatively small at the present time, signaling greed.

What the Fear & Greed Index means for investors

The Fear & Greed Index has been trending upward for several months. It crossed 55 in late March to enter greed territory, then it crossed 75 in early June to enter extreme greed territory. The index currently has a score of 81.

With that in mind, investors should exercise caution in the current market environment, but they should also understand the limitations of the Fear & Greed Index. Specifically, the technical indicators on which the index is based can be useful in analyzing short-term trends, but they do a poor job of predicting long-term performance.

Indeed, a recent publication from Johnson Research states: "The shorter the observation period, the more likely a relationship with the Fear & Greed Index will be observed." In other words, the index may provide clues about directional movements in the stock market in the coming days, but it tells investors nothing about the coming weeks, months, or years.

Here's the bottom line: While it is reasonable to be a little more cautious during periods of elevated greed, and perhaps even trim a position or two, now is not the time to start selling aggressively. Smart investors know that, so they are holding (or even adding to) their high-conviction investments.

Patience is the secret to making money in the stock market

Investors should never put too much importance on any single stock market indicator. There is no magic number or secret formula that can predict the future -- at least not consistently -- so investment strategies based on market timing will almost certainly fail at some point.

For that reason, investors would do well to stick with a long-term buy-and-hold strategy. History clearly shows that patience is the secret to making money in the stock market. The S&P 500 returned a 10% compound annual growth rate over the last 20 years despite suffering several bear markets and recessions, and investors have no reason to believe the next 20 years will look any different.

More broadly, while the Fear & Greed Index points to a possible continuation of the current bear market, investors can confidently assume a new bull market is coming. The S&P 500 has never failed to recoup its losses in the past, and the index has consistently hit new highs throughout history.