OPEN-SOURCE SCRIPT
Diupdate

RichmondHillCM - DXY vs BTC Lagged and Rescaled

206
DXY vs BTC — Lagged & Rescaled

This indicator compares Bitcoin against a time-shifted, inverted US Dollar Index (DXY) to visualize the inverse relationship between dollar strength and risk assets — with the dollar shifted forward so its past moves line up against where Bitcoin tends to follow.

How it works
- Both DXY and BTC are normalized to a 0–100 range over a rolling window, putting two very differently-scaled instruments on the same axis so they can be read side by side.
- DXY is lagged forward by an adjustable number of bars (default 18 ≈ 4.5 months on the weekly), reflecting the idea that dollar moves tend to lead Bitcoin rather than move with it.
- DXY is inverted by default, so the two lines track together whenever the historical inverse correlation is holding.
- The shaded fill marks divergence: green when BTC is running above the projected dollar path, red when it's below.
- A rolling correlation line is rescaled onto the same 0–100 axis: 50 = no correlation, below 50 = inverse (the normal regime for these two), above 50 = positive. It tells you how much to trust the overlay at any given moment.

Inputs
- DXY Lag — bars to shift the dollar forward
- Normalization Window — lookback used for the 0–100 rescaling
- Correlation Lookback — window for the rolling correlation
- Invert DXY — toggle the inverse view on/off
- Show Divergence Fill / Show Rolling Correlation — visibility toggles
- Configurable DXY and BTC symbols

Reading it
When the inverted, lagged DXY line and BTC line track closely and the correlation line sits well below 50, the dollar overlay is acting as a rough roadmap for price. When the correlation line drifts toward or above 50, the relationship has weakened and the overlay should be discounted. Large green/red divergences flag where BTC is leading or lagging the dollar's implied path.

Notes
The lag is a heuristic, not a fixed law — the optimal shift drifts across market regimes, so experiment with the lag and lookback values. This is a research and visualization tool, not a trading signal, and nothing here is financial advice.
Catatan Rilis
DXY vs BTC — Lagged & Rescaled (Auto-Lag)

This indicator compares Bitcoin against a time-shifted, inverted US Dollar Index (DXY) to visualize the inverse relationship between dollar strength and risk assets — and it now auto-calibrates the time shift, projects a forward bias, and tells you when to trust the overlay and when to ignore it.

How it works
- Both DXY and BTC are normalized to a 0–100 range over a rolling window, putting two very differently-scaled instruments on the same axis.
- Auto-Lag scans a range of lag values and picks the one where DXY's inverse lead/lag relationship with BTC is strongest (most negative raw correlation), then shifts the dollar forward by that amount. It re-evaluates every bar, so the lag adapts as regimes change. You can switch to a fixed manual lag anytime.
- DXY is inverted by default, so the two lines track together whenever the historical inverse correlation is holding.
- The shaded fill marks divergence: green when BTC is running above the projected dollar path, red when it's below.
- A rolling correlation line (rescaled: 50 = no correlation, below 50 = inverse, the normal regime) gauges how much to trust the overlay at any given moment.

Forward projection + reliability
- A signal label reads current (un-lagged) DXY through the same normalization and projects where BTC tends to head over the next ~lag bars — printing a HIGHER or LOWER bias.
- Critically, the signal is gated by reliability. The overlay is flagged RELIABLE only when the drawn lines are actually tracking; it's marked UNRELIABLE on a regime flip and WEAK when correlation sits near zero. When the overlay isn't reliable, the projected bias greys out — telling you to discount it rather than trade off a divergence that's just an artifact of a broken relationship.

On-chart labels
- Each line is labeled at its right edge (BTC, DXY with the active lag, and Correlation), with a floating signal box just past the last bar showing the projection, bias, and overlay status.
- An info table summarizes auto-lag state, active vs optimal lag, correlation, overlay reliability, projected bias, and all window settings.

Inputs
- Auto-optimize Lag — on/off, plus the scan Min/Max range
- Manual DXY Lag — used when auto is off
- Normalization Window — lookback for the 0–100 rescaling
- Correlation Lookback — window for the rolling correlation
- Invert DXY — toggle the inverse view
- Show Divergence Fill / Rolling Correlation / Labels — visibility toggles
- Configurable DXY and BTC symbols

Reading it
When the inverted, lagged DXY line and BTC track closely, the correlation line sits well below 50, and the overlay reads RELIABLE, the dollar projection is acting as a rough roadmap for price. When correlation drifts toward or above 50 and the status flips to WEAK or UNRELIABLE, the relationship has broken down and the projection should be ignored — a large divergence in that state is usually an artifact, not a signal.

Notes
The auto-lag finds the best-fitting shift over your chosen window, but the optimal lag drifts across market regimes and is a heuristic, not a law. This is a research and visualization tool, not a trading signal, and nothing here is financial advice.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.