OPEN-SOURCE SCRIPT
Aggiornato

Pair Currency Strength

216
📊 What is Pair Currency Strength?
This indicator is a professional-grade relative strength oscillator designed to identify true market divergences and trend reversals in Forex pairs.

Unlike traditional currency strength meters that isolate only the two components of your current chart—causing massive USD volatility to distort the lines—this script calculates a global 8-currency matrix in the background.

To keep your workspace 100% clean and focused on your trading execution, it visually renders only the two lines corresponding to your active chart's pair. Inspired by advanced macro analysis dashboards like MarketMilk (Babypips), this indicator strips away the overwhelming USD background noise and dynamically auto-adjusts the Y-axis scale so micro-divergences become instantly scannable.

🧮 How the Math Works (Why it’s a game-changer)
To completely eliminate USD-dominance bias, the script runs a global basket normalization algorithm on every single bar:

Simultaneous Multi-Asset Fetching: No matter which pair you are actively viewing, the script requests backend data for the 7 major currencies against the USD (EURUSD, GBPUSD, AUDUSD, NZDUSD, USDCAD, USDCHF, USDJPY).

Raw Return Calculation: It measures the percentage return of each currency based on your selected lookback window (22-bar rolling window by default, representing 30 calendar days of trading). The raw return of the USD itself is strictly benchmarked at 0.0.

Global Average Normalization: The script calculates the arithmetic mean of the entire currency market:

Global Average = (Sum of all 8 currency returns) / 8

Extracting True Strength: It subtracts this Global Average from each individual currency's raw return:

True Strength = Raw Return - Global Average

By removing the overall market's average drift, the USD stops being a flat line at zero and fluctuates dynamically. More importantly, the indicator's Y-axis contracts dramatically (auto-zooming in). This amplifies the micro-divergences between your chart's two currencies, forcing them into an elegant "mirror effect" around the zero line.
5. Exclusive Display Filtering: It detects the base and quote currencies of your active chart and instantly hides the other 6 currencies, leaving you with a laser-focused, distraction-free panel.

🛠️ Key Features & Inputs
Data Source Selector: Easily toggle between Spot Forex (utilizing dynamic broker feeds) and CME Futures (Pro) (utilizing institutional, high-liquidity continuous futures contracts like 6E1!, 6B1!, 6J1!, etc.).

Flexible Anchor Modes:

Rolling Period: A continuous lookback window of N bars (Set to 22 or 30 to track the classic "last 30 days" look).

Weekly Anchor: Every line resets strictly to 0.0 at Monday's market open, allowing you to track intra-week capital flows.

EMA Smoothing Filter: An optional moving average layer to shave off erratic price noise and algorithmic spikes, converting raw data into highly readable, organic curves without introducing critical execution lag.

📈 How to Trade with this Tool (Visual Strategy)
Trend Confirmation (The Mirror Effect): A healthy, strong trend is confirmed when the Base and Quote lines expand symmetrically in completely opposite directions away from the zero equilibrium line.

Line Crossover (Early Reversal Trigger): When the Base currency line crosses over the Quote currency line at overextended historical extremes, it serves as a high-probability warning of an impending structural shift on the main price chart.

Divergence Exhaustion: When the vertical distance between the two lines becomes unsustainably wide, the market "rubber band" is stretched to its limit. This is your cue to look for price action reversal triggers, as a retracement or consolidation is highly imminent.
Note di rilascio
feat: add squeeze alert and NOK currency to the basket

- Squeeze alert: fires when the distance between the two lines drops
below the contraction threshold (0.3% by default), signaling
convergence ahead of a potential crossover. Includes directional hint
for the upcoming cross (bullish/bearish) and a rising-edge guard so it
only fires once.
- NOK currency: spot USDNOK (USD as base, inverted) and CME:NOK1!
futures. The basket grows from 8 to 9 currencies, so avgRet now divides
by 9.0. strengthOf and currToString recognize NOK.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.