×

The market has done this just 4 times in the last 20 years

Something rare and potentially very dangerous is happening in the market right now. And if history is any indication, it could spell short-term pain.

The S&P 500 has closed above its five-day moving average for 20 consecutive days. That has only happened just three times before in the last two decades.

Now, here's the sad part: Four weeks after each of one those streaks came to an end, the S&P 500 was down, for an average loss of 3 percent. That's according to a recent study by Jonathan Krinsky, chief market technician at MKM Partners.

What's more, the S&P 500 has had just seven prior streaks above its five-day moving average lasting 18 days or more. And those, too, also averaged losses four and six weeks after ending.

(Watch: Wal-Mart helps lift Dow industrials to record finish)

Does that mean there will be bad news for stocks soon?

"The last time we saw a decline like we saw in October, which was about 9 percent, was back in September to November 2012," Krinsky said. "To recover 12 percent off the lows took 49 trading days. We just rallied 12 percent off the lows in 19 trading days. So the ascent of the rally has been rather remarkable."

(Read: Asian markets seen higher on Wall Street lead; oil in focus)

And because the five-day moving average is such a short-term indicator, the fact that the S&P 500 has remained above it for four weeks makes the rally so remarkable and unusual, he said.

But with Thursday's close at 2,039.33, the S&P 500 is extremely close to hitting an important level, according to Krinsky. "We're pushing against a pretty good area of resistance around 2,040," he said.

If that resistance holds, heforesees the index returning towardan area between 1,970 and 1,980, roughly 3 percent lower from current prices.

That's not enough to worry Krinsky, however. "Nothing too concerning," he said. "But risk/reward from this level seems to favor the downside."

-----
Follow us on Twitter: @CNBCNumbers
Like us on Facebook: facebook.com/CNBCNumbers