Why investors love midterm election years

Post election history on side of bulls
Post election history on side of bulls   

For all the deep and thoughtful analysis of how a changing congressional landscape will affect the economy and markets, some investors are turning to a very simple strategy to profit from the midterm elections: Buy an index fund!

There's a reason why investors salivate when midterm elections cycle through. It's been a very bullish catalyst for the markets, and has been for decades. According to Chief Equity Strategist Sam Stovall of S&P Capital IQ, the seasonality associated with midterms has brought positive returns for the stock market a lot more than it has brought losses. Stovall notes that since 1946, there have been 17 midterm election years. On average, the S&P 500's return between Oct. 31 of the midterm year and Oct. 31 of the following year has been an eye-popping 17.5 percent. What's even more staggering is how many times the index has produced a positive return … 17.

In other words, if investors had bought the S&P 500 just before each midterm election and held it for a year, they'd have made money 100 percent of the time. The best-performing span occurred after the 1954 midterms, with the S&P 500 rising 33.6 percent in the year following.

The worst performing one-year span occurred just after the 1986 midterms, with the index rising 3.2 percent. It's worth noting that the October-to-October period following the 1986 midterms also included the Black Monday stock market crash on Oct. 19, 1987, when the S&P 500 dropped 20 percent in one day. Even with that, the index managed to book a positive return for the year ended Oct. 31, 1987.

Midterm election plays: Defense, aerospace & more
Midterm election plays: Defense, aerospace & more   

Read MoreHow to trade the midterm elections: Pros

If the thought of sticking with a trade for a full year isn't nearly as appealing as it has been in the past, consider what happens with stocks in the six-month window following midterms. Between the months of November of a midterm election year and April of the following year, the S&P 500 has gained an average of 15.3 percent and has been positive 94 percent of the time, Stovall says.

Of course, past performance is never a guarantee of how things will fare in the future. There is a plethora of reasons why investors should be worried. After all, there's slowing growth in Europe and China, falling oil prices around the world, fear of deflation, geopolitical risks in the Middle East, an uneven housing recovery in the United States, etc. U.S. stock markets are sitting near record highs and haven't experienced a significant pullback since 2011. That's just a short list of reasons why investors are worried.

Read MoreBeware: A poisoned stock market in 2015

The bulls will point to midterm seasonality as a reason for why the party will continue into 2015. The bears say all good things, like winning streaks, must come to an end. This could be the year when it all goes wrong, but until then, optimists will point to around 70 years of market history as being on their side.

Check out CNBC's live blog on the midterm election results