Traders work on the floor of the New York Stock Exchange in New York City.

Stocks rocketed higher in the first two months of the year. If history is any indication, equities are primed for further gains moving forward.

Data compiled by LPL Financial show the has posted gains in the final 10 months of the year in 25 of the 27 times it started a year with back-to-back gains in January and February. LPL's data go back to 1950. The S&P 500 rose 7.87 percent and 2.97 percent in January and February, respectively, notching its best start to a year since 1991.

Tweet

"This bounce has surprised so many people," Ryan Detrick, senior market strategist at LPL Financial, told CNBC. "Analysts freaked out and cut their estimates too much. Too many people thought there was going to be a recession in 2019 on that freak-out in the fourth quarter. Now we're seeing the realization that earnings are still OK. They're not great, but they're better than those lowered expectations. We also know the economic data has been a little on the weak side, but we think this is just a lull in the economic data and we think it can get stronger."

The S&P 500 plummeted in December, leading the index to its biggest annual decline since the financial crisis. Fears that economic growth would slow down, along with worries over Federal Reserve monetary policy and U.S.-China trade negotiations, propelled the broad index lower.

However, the Fed signaled earlier this year it would be patient in raising rates while China and the U.S. appear to be nearing a trade deal. Meanwhile, corporate earnings for the fourth quarter grew by 13.08 percent, according to FactSet data.

So far this year, the S&P 500 is up more than 11 percent.

Investors also have positive seasonal factors in their favor moving forward. March and April are historically two of the best months for the S&P 500, data from the Stock Trader's Almanac show. Since 1950, the S&P 500 has averaged a gain of 1.2 percent in March and a rise of 1.4 percent in April.

"Technically and fundamentally and seasonally, things are pretty strong," said Jeffrey Hirsch, editor in chief of the "Stock Trader's Almanac." "Geopolitically, there are still some risks, but the Fed is on pause and that's a positive."

LPL's Detrick said stocks could rally to record highs over the next 10 months, but it will likely be a bumpy ride.

"We do think this bull market is alive and well. We do not see a recession in 2019. So yes, this will resolve higher. But the easy part is over," he said. "The next 10 are going to be a lot tougher is going to be a lot more aggravating to investors."

Subscribe to CNBC on YouTube.