OPEN-SOURCE SCRIPT
Yield Strength

This indicator measures the relative strength of major currencies based on the yield differential (interest rates) of each country's government bonds, rather than price.
How it works:
Fetches the government bond yield (2Y, 5Y, or 10Y, selectable) for 8 economies: US, Eurozone, UK, Japan, Australia, New Zealand, Canada, and Switzerland.
Calculates the yield spread between the current chart pair (e.g., EURUSD = EUR yield − USD yield) and plots it alongside two EMAs (fast and slow) of that spread, signaling trend crossovers with a color change (green = bullish, red = bearish).
In parallel, calculates the yield spread for all 28 possible pairs among these 8 currencies and applies the same EMA-crossover logic to each.
Consolidates everything into a scoreboard in the corner of the screen: each currency gains or loses points depending on whether it's on the "strong" or "weak" side of the yield in each of the 28 pairs — producing a relative strength ranking of currencies based purely on implied monetary policy/interest rates, not price.
Why it's useful:
Yield differential is one of the main drivers of flow in forex (carry trade, rate expectations). This indicator translates that macro concept into a visual signal and an objective ranking, useful as a context/trend filter for swing trading, without relying on traditional price-based indicators.
How to use it:
Recommended timeframe: works best on higher timeframes — H1, H4, or D1. Since it's based on yield differentials (a slow-moving macro driver), it's not suited for scalping or very low timeframes, where price noise dominates and the interest-rate signal loses relevance.
Best used with the trend. Use it as a context filter, not a standalone entry trigger. When the spread and EMAs are aligned with the pair's price trend direction, it reinforces that the macro flow is "pushing" the pair in the same direction — giving more confidence to trade with that trend.
Scoreboard: use the strength ranking of the 8 currencies to spot "stretched" pairs (strong currency vs. weak currency) — usually the best candidates for trend-following entries backed by this macro driver.
Color crossovers (green/red) on the spread's EMAs signal a regime change — useful for confirming the yield trend is still active before entering, rather than already exhausted.
Technical: Pine Script v6. All 28 spreads are calculated locally from just 8 request.security calls (one per currency), working around TradingView's 40-security limit even while analyzing 28 pairs.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.