The stock market is having its best start to year in more than three decades. Based on historical evidence, that spells even more gains for the rest of 2018.

When the S&P 500 posts a return of at least 5 percent by Jan. 23, the index's median return for the rest of the year has been 11.6 percent, according to Bespoke Investment Group.

"With a 6.1 percent year to date gain and just three down days in the fifteen trading days of 2018, nothing can seemingly stop this market in 2018," the firm's analysts wrote Wednesday.

has already rallied 6.2 percent in January, posting only three down days and clinching its strongest showing since 1987. The Dow Jones industrial average is also having a banner start, closing above 26,000 one week ago as equities rocket even higher.

The S&P and Dow both notched all-time highs Wednesday morning before surrendering much of their gains.

"The history is pretty good for years where the first week starts off strong and the first month starts off strong," said Art Hogan, chief market strategist at B. Riley FBR. "It's hard to argue that the [stock] drivers are not going to be persistent: Synchronized global economic growth seems to be continuing, better than expected earnings … and we're also finding out how much corporate America's effective tax rates are coming down."