OPEN-SOURCE SCRIPT
Updated

10Y Yield Spread - Auto FX Pair

208
10Y Yield Spread — Auto FX Pair

Automatically displays the 10-year government bond yield spread for the FX pair currently on your chart. Switch from EURUSD to USDJPY to GBPAUD and the indicator instantly recalculates — no manual reconfiguration needed.

What it shows

The spread between the base currency's 10Y yield and the quote currency's 10Y yield, expressed in basis points. For example:
  • USD/JPY → US10Y minus JP10Y
  • EUR/USD → DE10Y (Bund) minus US10Y
  • GBP/AUD → GB10Y minus AU10Y


A positive spread (green) means the base currency offers a yield premium — historically a tailwind for the pair. A negative spread (red) means the opposite. The wider the spread, the stronger the rates differential pushing the pair.

Why it matters

Yield differentials are one of the most reliable medium-term drivers of major FX pairs. When the spread trends one way and the pair trends the other, you're often looking at a setup waiting to resolve — either the pair catches up, or the spread breaks. Particularly powerful for:
  • Carry trade decisions (positive spreads = positive carry on the long side)
  • Filtering FX trades against the macro backdrop
  • Spotting divergences between price and rates
  • Anticipating central bank repricing impact across pairs
  • Confirming or fading reactions to CPI, NFP, and rate decisions


Supported pairs

All combinations of the 8 majors: USD, EUR, JPY, GBP, AUD, NZD, CAD, CHF. Auto-detection works on standard naming (EURUSD, EUR/USD, OANDA:USDJPY, FX:GBPJPY, etc.). For exotic symbols or futures, switch to Manual mode and pick base/quote from the dropdowns.

Yield benchmarks used

  • USD → US10Y (US Treasury)
  • EUR → DE10Y (German Bund, eurozone benchmark)
  • JPY → JP10Y (JGB)
  • GBP → GB10Y (Gilt)
  • AUD → AU10Y
  • NZD → NZ10Y
  • CAD → CA10Y
  • CHF → CH10Y


Settings

  • Moving average: configurable SMA overlay (default 50) to smooth the spread trend
  • Zero line: visual reference for spread sign change
  • Background fill: green above zero, red below — instant regime read
  • End label: shows current pair and live spread value in bps
  • Pair detection: Auto (reads chart ticker) or Manual (override with dropdowns)


Recommended setup

Works on any FX chart timeframe from 15m to daily. For best results, pair this with my companion indicator Bond Yield Strength — 10Y Majors to see the full rates landscape alongside the specific spread of your pair.

Notes

DE10Y (German Bund) is used as the EUR proxy — it's the de facto eurozone benchmark used by rates desks globally. Data availability for some symbols depends on your TradingView plan; if a yield doesn't render, your plan may not include that exchange.

Feedback and suggestions welcome.
Release Notes
Update: overlay of the spread on the FX pair

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.