As the Dow Jones Industrial Average DJIA, +0.19% , S&P 500 SPX, +0.29% , and Nasdaq Composite COMP, +0.36% lost anywhere from 6.6% to 7.9% in the worst May for stocks since 2010, bond prices have soared.

Bond yields, which move in the opposite direction from price, dipped below 2.1% on the benchmark 10-year Treasury note TMUBMUSD10Y, 0.671% on Tuesday, from 3.23% last November, a gigantic move for bonds in such a short time.

Meanwhile, shorter-term rates have held steady, creating the dreaded prospect of an inverted yield curve — when long-term yields fall below shorter-term yields. This has been an excellent predictor of economic recessions, and one expert on the yield curve says the current inversion is flashing yellow, if not red, for markets and the economy.

Campbell Harvey, a professor at the Fuqua School of Business at Duke University, has tracked yield curve inversions for more than 30 years. He showed the reliability of the indicator in his doctoral dissertation at the University of Chicago in 1986.

That dissertation (reviewed by an all-star committee that included future Nobel Prize winners Eugene Fama, Merton Miller, and Lars Hansen) showed that an inverted yield curve would have anticipated the previous four recessions. After its publication, the model predicted the next three recessions — 1990-91, 2001, and 2007-09 — so it has a perfect track record going back about 40 years.

Economists and traders track several different yield curves, but Harvey prefers the spread between the three-month Treasury bill and the five- or 10-year Treasury note. The chart below, reprinted with his permission, shows there’s been little difference between those two yield curves over time.

Harvey’s chart shows the yield curve projections of a recession’s probability hit 80%-100% in the 1970s and 1980s, then settled into the 40%-50% range for the last three recessions. As of June 3rd, the yield curve implied about a 40% probability of a recession — definitely within the danger zone.

Harvey considers this indicator definitive only if an inverted yield curve lasts for an entire quarter. He’ll know for sure by June 30th, but my own review of the data shows the spread between the three-month and five-year Treasury — but not the three-month and 10-year — will turn out to have been inverted for most of this quarter, which means trouble ahead.

“Unconditionally, it means slower growth is coming. The empirical track record suggests that if you have a full quarter of inversion, then that is followed by a recession,” Harvey told me from London in a telephone interview on Monday. “This is kind of ominous, because it seems like we have this momentum whereby…it was reasonably flat, and then we're becoming more and more negative. The momentum suggests that this signal will be flashing red fairly soon.”

That concern is underscored by the latest Duke University/CFO Global Business Outlook, which found that 67% of the chief financial officers surveyed believe the U.S. will be in a recession by the fourth quarter of 2020, while 84% believe a recession will be underway by the first quarter of 2021. That’s pretty much in line with a negative yield curve’s 12- to 18-month lead time in predicting recession, Harvey said.

A negative yield curve doesn’t cause recession, Harvey emphasized, but it does have a huge impact on sentiment from the trading floor to the executive suite. “People see this, it's a red flag, and they change their behavior,” he explained. “So, consumers, maybe, we're not going to run up the credit card and take that vacation to Orlando this year. And for businesses, now we're thinking of building this new facility, why don't we wait a little bit?”

But it’s more than just a negative feedback loop or self-fulfilling prophecy. “You should think of it as people doing the right thing in terms of risk management,” Harvey said.

Greater caution, he added, “actually increases the chance that, if there is a downturn, it's a lot softer. I much prefer the mild [recession]. I want to engineer the soft landing. One way to do that is for consumers and corporations to be prudent when they're faced with these red flags.”

Harvey is an academic and doesn’t give investment advice. But taking his observations to their logical conclusion, I think this is a good time to be prudent in your investing profile as well. If you have more than your target allocation in stocks, I’d take some profit on any market rallies of the kind we saw Tuesday after Federal Reserve Chairman Jerome Powell said he was open to a rate cut. (Long rates rose a bit, too, but the yield curve remained solidly negative.)

I’d also put more money into bonds, especially intermediate-term Treasury funds and ETFs, such as the Vanguard Intermediate-Term Treasury ETF VGIT, , which are the cheapest, easiest and best hedge against stock market risk. In this way, you can turn a negative yield curve from your enemy into your friend.

Howard R. Gold is a MarketWatch columnist. Follow him on Twitter @howardrgold. He does not own any of the securities mentioned in this column.

Read: Bond-market inversion resembles 1998 — meaning ‘peak risk-off’ for the stock market

More: An inverted yield curve is usually scary. Not this time