Stocks are on a roll this year and a chart pattern in the S&P 500 could signal further gains for Wall Street.
The S&P 500 formed an "inverse head-and-shoulders" pattern over the past three weeks as it broke above key levels and inched closer to its record high from Sept. 21. An inverse head and shoulders pattern is used by chart analysts as a sign that a stock or an index could rise further after forming a bottom.
The index tried to break above 2,800 — a closely watched resistance level by traders and technicians — twice between late February and early March before sliding back down to around 2,730 by March 8. The S&P 500 then surged from that level and has closed above 2,800 for five straight sessions.
"This has been building since the comeback started," said Frank Cappelleri, executive director at Instinet. "We didn't know how fierce it was going to be and the extent of it. But needless to say 2,800 is on a lot of screens for numerous reasons. It's acted as a resistance level at times and support as well."
Cappelleri added the recent formation is part of a bigger head-and-shoulders pattern that has been forming since last October.
He also said this pattern is pattern "is not just specific to the S&P 500. It's seen in a lot of different places. Some areas are leading; some are lagging, but in general the shape that has developed over the past six months."
The S&P 500 is down more than 2.5 percent over the past six months, but it is up more than 20 percent since bottoming in late December. The index closed at 2,832.57 on Tuesday, about 3.7 percent away from its all-time high of 2,940.91.
Stocks are not completely out of the woods yet, however. The utilities and real estate sectors — which are often referred to as bond proxies for their low volatility compared to other parts of the market — are the best performers over the past six months.
"I don't know if that type of leadership can continue if this risk-on mentality continues as it is," Cappelleri said. However, "they haven't had to advance as much from the lows since they didn't get as beat up on the way down. What we want to see is if other sectors can take the baton."
The S&P 500 is up more than 12 percent so far this year and is on pace for its biggest one-year gain since 2017, when it surged 19.4 percent.