President Donald Trump has a very good chance of winning the 2020 presidential election against Joe Biden, if a more than 200-year overview of the stock market is to be believed.

That’s according to research from the Socionomic Institute, a group that has long used the stock market to predict electionsand economic and cultural trends.

The research, going back to George Washington, found 16 times in U.S. history when an incumbent president ran for reelection and the stock market was up more than 20% in the preceding three years. In 14 of those 16 times, the incumbent won reelection, giving a success rate of 87%. If the trend holds, Mr. Trump could be No. 15.

The two times it didn’t work out, for reference, were George H.W. Bush, who lost to Bill Clinton in 1992 even though the stock market was up 38% in the preceding three years, and John Adams, who didn’t win his reelection bid in 1800, despite the fact that the value of capital in U.S. chartered banks had risen by 30% in the previous 5 years. (At the time, federally chartered banks were the only publicly traded stocks in the young republic.)

“The stock market is an indicator of social mood,” said Matthew Lampert, who is the director of research of the group. “Historically, a more positive trend in the market and social mood is associated with a win for the incumbent.”

That gives Mr. Trump a pretty clear historical edge. But there are some huge caveats to consider before concluding that he will have another four years in the White House.

Poll: Biden leads Trump in Wisconsin

First, the stock market as we know it and measure it today, doesn’t go back all the way to George Washington. While public investments traded as early as 1792 in the U.S., initially they were mostly bonds or banks backed by the government. The Dow Jones industrial average wasn’t published until 1896. Return data before that had to be recreated with the help of another research organization.

Second, while the stock market does at times match the “social mood” of the country, that seems far from the case right now. A recent Gallup poll found that only 14% of Americans were happy with the direction of the country, despite the market being up 32% in the past three years.

Indeed, a number of top stock market strategists have recently said they believe the recent increase in the stock market is signaling a win for Joe Biden, not Mr. Trump. Goldman Sachs, for instance, told clients in a research note last week that the odds of Biden winning the presidency and Democrats gaining a majority in the Senate was roughly 65%. Analysts with the investment bank pointed out that stock prices have been rising since September, coinciding with political polls tilting increasingly toward Biden.

What’s more, the Socionomics researchers found that the market is more reliable in predicting elections when the gains are across a number of sectors, and not concentrated in a single sector, like tech, as they are now. For instance, when George H.W. Bush lost, the average stock in the broad market was actually down 11% during the prior three years, even though the Dow, which only tracks 30 major stocks, was up in the same time.