OPEN-SOURCE SCRIPT

Yield Curve

By Hedge_1
Updated
This script tracks the U.S. 2Yr/10Yr Spread and uses inversions of the curve to predict recessions. Whenever a red arrow appear on the yield curve, expect a recession to begin within the next 2 years. Use this signal to either exit the market, or hedge current positions. Whenever a green arrow appears on the yield curve, expect a recession to have nearly ended. Use this signal to enter the market, or cut current hedges against a recession. (I may update this script in the future to better incorporate the effective federal funds rate into exit points, but for now I am satisfied with the results).
Release Notes
This script tracks the U.S. 2Yr/10Yr Spread and uses inversions of the curve to predict recessions. Whenever a red arrow appear on the yield curve, expect a recession to begin within the next 2 years. Use this signal to either exit the market, or hedge current positions. Whenever a green arrow appears on the yield curve, expect a recession to have nearly ended. Use this signal to enter the market, or cut current hedges against a recession.
Release Notes
There was a problem with time frames less than (All-Time) not showing specific exit/entry points. I have fixed the script to always specify an exit point at a yield curve inversion. This version is final and will likely not be further edited.
Release Notes
Updated script to better reflect entry and exit points
hedgerecessionS&P 500 (SPX500)SPDR S&P 500 ETF (SPY) treasuriestreasurybondstreasuryyieldTrend Analysisyieldcurveyieldcurveinversion

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer