(CNBC) — A lot has been written recently about how U.S. stocks usually perform well after the midterm elections. But a deeper dive into the data shows the post-midterms rally hinges on the majority party maintaining control of the House.

Data compiled by Fundstrat Global Advisors showed the median stock market return since 1896 was only 1.9 percent a year after the House majority flipped from one party to the other. Meanwhile, the median return totaled 16.8 percent when the House majority stayed the same after the midterms.

Fundstrat used Dow Jones Industrial Average data to calculate returns before 1945 and S&P 500 data for returns post 1945.

Note: Read our discussion guidelines before commenting.