OPEN-SOURCE SCRIPT
10Y–2Y Treasury Yield Curve Spread & MES % Change

📝 Description:
This indicator tracks the U.S. 10-Year minus 2-Year Treasury yield spread — a powerful macroeconomic signal often used by professional traders to gauge market sentiment and recession risk — and overlays an optional MES % change line to help intraday futures traders spot macro–price divergences in real time.
Features:
🏦 Plots the 10Y–2Y spread, with optional EMA smoothing.
📉 Highlights yield curve inversion (background turns red when spread < 0).
📊 Optional MES % change line from daily or RTH open for directional bias.
🔔 Alert conditions for:
Yield curve inversion / un-inversion.
Sudden spread spikes in basis points (customizable).
🧮 Optional correlation plot to visualize relationship strength between MES and the yield curve.
🧭 Z-score normalization allows both series to be viewed in one pane without scaling issues.
Why it matters:
A falling or inverted 2s10s spread often signals risk-off behavior and pressure on equities.
A steepening curve tends to support risk-on rallies.
Divergences between MES price action and the spread can provide early warning signals of reversals or fakeouts.
Best used with:
MES (MES1!) or MYM charts for intraday & swing bias.
Fed event days, CPI/NFP, or any macro-sensitive sessions.
VWAP or structure-based intraday trading strategies.
⚠️ Note: This indicator is for informational purposes only and does not constitute financial advice. Always combine macro context with your own trade plan and risk management.
This indicator tracks the U.S. 10-Year minus 2-Year Treasury yield spread — a powerful macroeconomic signal often used by professional traders to gauge market sentiment and recession risk — and overlays an optional MES % change line to help intraday futures traders spot macro–price divergences in real time.
Features:
🏦 Plots the 10Y–2Y spread, with optional EMA smoothing.
📉 Highlights yield curve inversion (background turns red when spread < 0).
📊 Optional MES % change line from daily or RTH open for directional bias.
🔔 Alert conditions for:
Yield curve inversion / un-inversion.
Sudden spread spikes in basis points (customizable).
🧮 Optional correlation plot to visualize relationship strength between MES and the yield curve.
🧭 Z-score normalization allows both series to be viewed in one pane without scaling issues.
Why it matters:
A falling or inverted 2s10s spread often signals risk-off behavior and pressure on equities.
A steepening curve tends to support risk-on rallies.
Divergences between MES price action and the spread can provide early warning signals of reversals or fakeouts.
Best used with:
MES (MES1!) or MYM charts for intraday & swing bias.
Fed event days, CPI/NFP, or any macro-sensitive sessions.
VWAP or structure-based intraday trading strategies.
⚠️ Note: This indicator is for informational purposes only and does not constitute financial advice. Always combine macro context with your own trade plan and risk management.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.