OPEN-SOURCE SCRIPT
업데이트됨 RichmondHillCM - DXY vs BTC Lagged and Rescaled

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.
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.
릴리즈 노트
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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.