Wall Street begins the home stretch of the year in good stead.

The S&P 500 ended the third quarter Friday with its best performance since 2013, and all three benchmark indexes closed out September one rally from record highs they set earlier in the month.

October has a reputation for monumental crashes such as those in 1928 and 2008, but historical data back up a push to new heights, says Ryan Detrick, senior market strategist at LPL Financial.

"People hear October and they remember these spectacular crashes, but when you look back in history, October is really not that bad," Detrick told CNBC's "Trading Nation" on Friday. "The last 20 years October for the S&P 500 is actually the strongest month of the year."

The S&P 500 has risen by an average 2.1 percent in October over the past 20 years. August and September are typically the weakest months of the year.

Against common investor thinking, the month leading up to the November midterm elections is also historically strong for stocks, says Detrick.

"Going back to 1950, October is the strongest month again looking at midterm years. Since 1982, October in midterm years has only been down once, so October is really strong seasonally," Detrick said.

In fact, this three-quarter stretch beginning on Monday is the strongest of any period of the presidential cycle, he says. The fourth quarter of a midterm year typically rises an average 7.8 percent, according to data since 1950.

Detrick has confidence in this stock market beyond seasonal factors.

"The fundamentals continue to be strong, earnings are still strong," he said. "It's still a broad-based rally. Technology pulls back a little bit, health care and industrials take over. That's what a bull market does, certain groups take that baton."

If stocks buck the seasonal trend in October, Detrick would not lose faith in the stock market run, especially after a six-month win streak in the S&P 500.

"We could be due for a well-deserved break, but November, December [will be] still pretty strong and we expect stocks to outperform bonds once again in the fourth quarter here in 2018," he said.

The S&P 500 has risen 10 percent since the beginning of April. It hit its most recent record high on Sept. 21.