Yield Curve Inversion Indicator

In the late 80s, Cam Harvey demonstrated that the shape of the yield curve foreshadows economic downturns. So when the spread between a long-term US Treasury yield (5 year or 10 year) and a short-term US Treasury yield (3 months) is negative (or inverted), this is a bad sign for the economy. For stocks too, since we all know that most bear markets occurred during recessions. According to research studies, the yield curve inversion signal has worked pretty well in the last decades: It predicted essentially every US recession since 1950. There have been only two false positives: an inversion in late 1966 and a very flat curve in late 1998.

Treasury Yield Curve and NBER Recessions
US Yield Curve Spread (10y/3m)
Source: St. Louis FED

Yield Curve Inversion in March 2019 – Recession 2020 ahead?

In March 2019, for the first time since summer 2007, the yield curve has become inverted. If you take a look at the past, the yield curve has a lead time of 12 to 18 months before a recession. So, is the next recession on the way? Unsurprisingly, this question has became a hot topic in the media and finance worlds over the last few months. Take a look at the Google search volume here:

Google search volume for "yield curve inversion"
Source: Google Trends

Equilla Indicator Code for Visualising Inversions

One of Harvey’s key points is that the inversion needs to last for a quarter; short-term dips which last only a few days do not count. The following Equilla code is an useful indicator which highlights yield curve inversions on any given chart, for example the S&P 500.

  • You can control the minimum length of the inversion with the input MinLength in line 3.
  • Example: When using weekly bars, then using 12 would only display yield curve inversions when they lasted at least 12 weeks.
  • As you can see in line 8, I use Eikon tickers for the yield curve spread calculation. If you use other data feeds, please modify accordingly.
Equilla code for yield curve inversion
Equilla Code for Yield Curve Inversion Indicator

And here`s when I apply the indicator on the S&P 500. You can see the last inversions highlighted in red. By the way, if you want to display the yield curve spread in a subchart like I did, I recommend creating a formula symbol which just contains the calculation from line 8.

S&P 500 and Yield Curve Inversions
S&P 500 with 10Y/3M Yield Curve Spread. Inversions are highlighted in red.

Using the indicator code from above, you could add some simple sell rules and then backtest the efficiency of the yield curve as an exit signal for the stock market. On the following chart you can see how the S&P 500 cash index has performed n weeks after an inversion signal was triggered (data starts 1985, so the sample size is very small).

S&P 500 Backtest Results for Yield Curve Inversions
Backtest Results for S&P 500


Please contact us if you would like to know more and subscribe to our blog 🙂

Tradesignal® is a registered trademark of Tradesignal GmbH. Unauthorized use or misuse is strictly prohibited. Data by Refinitiv Eikon.
Copyright www.welovealgos.com. Terms of use: welovealgos.com/terms-conditions

2 thoughts on “Yield Curve Inversion Indicator

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to this Blog