The stock market provides long-term savings returns for millions of investors and retirement savers around the world. But it has also been a fairly accurate predictor of who is going to win the Presidential election. It has, in fact, shown who is going to win the race in 19 of the past 22 U.S  presidential elections.

The predictor here is very simple. If stocks in the S&P 500 rise between Aug. 8 and Nov. 8, then the incumbent political party will win the election. If stocks fall during that time, then the opposing party will win. This means that Hillary Clinton will win the election if stocks rise, and Donald Trump will become President if they fall during this period. (For more, see: 4 Ways that the Presidential Election Will Affect Your Portfolio.)

Daniel Clifton at Strategas Research Partners explained to Business Insider why this factor has been so accurate. “Intuitively, this trend makes sense. If the economy is weakening, stocks should be declining and the incumbent party will likely suffer. Moreover, should it look like a new party is to take control of the White House, the change in control could add uncertainty to investors until the new President gets his or her rhythm.

In fact, we have found that "open" election years, a year in which no incumbent is up for reelection have been tougher for stocks than presidential reelection and non-presidential election years. Interestingly, stocks have rallied in the past two (and rare) instances when a political party has received a third term.”

Ultimately, what seems to be happening with this correlation is that stock performance reflects the general trend of the economy. When it's good, then voters are content to keep the incumbent party in office. When the economy is bad, then voters will seek a change. This relationship can perhaps be best summed up by the political phrase, “It’s the economy, stupid!” (For more, see: Critical Economic Issues for Elections.)

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.