Stocks love when midterm elections are over

party bull

Get ready for a midterm election after-party on Wall Street.

If history is any guide, stocks are about to rise a lot. U.S. stocks have gone up substantially during the six months following the past 13 midterm elections.

If that perfect track record isn't compelling enough for you, the average S&P 500 rally during those six-month stretches was an impressive 16.5%, according to BTIG. That crushes the average November to April gain of just 3.7% in all other years.

"After midterms, you often get deals that investors view favorably. Ultimately, you end up with higher stock prices," said Dan Greenhaus, chief global strategist at BTIG.

election stocks

Related: Dow hits new record after GOP win

Just because stocks performed a certain way in the past doesn't mean it will be the same way this time around. It's also important to remember, as Greenhaus notes, that the data BTIG is using only goes back to 1964. That's a relatively small sample size.

Still, it's easy to see why Wall Street enjoys a relief rally as political rhetoric dies down, uncertainty ends and lawmakers are forced to go back to governing.

Divided government is good for stocks: History also shows that the Republican victory caused by the 2014 midterm elections has produced some blockbuster results for equities.

Related: 3 sectors to benefit from GOP win

According to S&P Capital IQ, the S&P 500 has climbed an average of 15.1% in the calendar years since 1945 with a Republican-controlled Congress and a Democratic president. That's the best performance for any of the possible political scenarios, narrowly edging out when the GOP controls both Congress and the White House.

The worst political scenario for stock prices, historically speaking, has been when there's a Republican president and a split Congress. The S&P 500 has increased an average of just 3.5% in that situation, Capital IQ said.

Wall Street has already responded favorably to the 2014 midterm election results. The Dow touched a new all-time high on Wednesday, giving it a year-to-date gain of 5%.

Related: Wall Street dumps Democrats

Why is Wall Street happy? The hope among investors is that the GOP victory could pave the way for some pro-business policies.

"We believe the election results improve structural policymaking conditions," analysts at the Eurasia Group wrote in a note on Wednesday. "Some number of big ticket policy items will actually advance through a nasty and partisan climate over the next year."

Eurasia Group pointed to a small number of pro-business policies that could be "material," including pro-trade policies, a decision on the Keystone XL pipeline and legislation that would streamline the process to approve liquefied natural gas exports.

Those hopes help explain why the S&P 500 energy sector was the best performer on Wednesday after being the biggest laggard all year.

Other possibilities include infrastructure investment, lifting the ban on crude oil exports and maybe even laying the groundwork for an overhaul of the corporate tax code.

"If these agreements begin to take place, you build some positive sentiment for higher stock prices," Greenhaus said.

CNNMoney Sponsors