OPEN-SOURCE SCRIPT
BTC/XAU Correlation Crossing Delay Performance

OVERVIEW
The BTC/XAU Correlation Crossing Delay Performance indicator is a specialized macro-tool designed to track the structural relationship between Bitcoin (Digital Gold) and Physical Gold. In institutional finance, these two assets represent the "Scarcity Complex." While they are often viewed as similar, they move in distinct Regime Shifts. This script identifies the exact moments of correlation decoupling—historically a lead indicator for major Bitcoin volatility and catch-up rallies.
THE IDEA: THE DECOUPLING SIGNAL
Traditional safe havens like Gold often act as a "Smoke Alarm" for geopolitical fear. Bitcoin, however, functions more as a "Fire Department" for global liquidity expansion. When the 52-week correlation between the two drops to zero or below, it signals a structural divergence.
Data from the past can suggest that such "Zero-Cross" events occur when Gold has front-run a price move, leaving Bitcoin at a relative valuation discount. This script marks these "Regime Shifts" (M-Markers) and measures the subsequent performance during a customizable Alpha Window.
CALCULATIONS & METHODOLOGY
The script utilizes the following logic to generate its data points:
• Purchasing Power Ratio: Calculated as Bitcoin Price divided by Gold Price. This shows exactly how many ounces of gold 1 BTC can buy.
• Pearson Correlation: A rolling 52-week calculation measuring the linear relationship between BTC and Gold prices.
• Zero-Cross Signal: A logic trigger/Marker that fires when the correlation value drops from a positive state to zero or a negative value.(M1 - M-n)
• Alpha Performance: A secondary calculation that captures the BTC price at the signal bar and compares it to the price exactly N-weeks later.
HOW TO READ THE CHART
• Orange Line: The current BTC/Gold ratio. A rising line means Bitcoin is gaining purchasing power against Gold.
• Orange Vertical Shapes (M-n): These mark the "M-Signals" where correlation broke (correlation ratio turned from positive to 0 or below on that bar). This is the "coiled spring" phase.
• Blue Vertical Shapes (Result): These appear after your defined Alpha Window (e.g., 12 weeks). They display the percentage change for both the Ratio and BTC/USD price since the M-n-signal.
• Blue Area (middle Lane): A visualization of the raw correlation value. When this cloud disappears toward the zero-level, a regime shift is in progress.
USER INPUTS
• Tickers: Choose your preferred Bitcoin and Gold sources (e.g., INDEX:BTCUSD or TVC:GOLD).
• Correlation Lookback: Default is 52 weeks, the institutional standard for measuring annual macro cycles.
• Alpha Window: Define the number of weeks (e.g., 12) you wish to track after a decoupling signal to verify historical catch-up trends.
TIMEFRAME
I view the data on the weekly timeframe. The script is optimized to run on this timeframe.
DISCLAIMER
This script is provided for educational and research purposes only. Correlation shifts are indicators of market structure changes and do not guarantee future price direction. Past performance of the BTC/Gold ratio is not an indicator of future results. Always use comprehensive risk management when trading high-volatility assets.
TAGS
Rob Maths, robmaths, Rob_Maths, Bitcoin, Gold, Ratio, Correlation, Macro
The BTC/XAU Correlation Crossing Delay Performance indicator is a specialized macro-tool designed to track the structural relationship between Bitcoin (Digital Gold) and Physical Gold. In institutional finance, these two assets represent the "Scarcity Complex." While they are often viewed as similar, they move in distinct Regime Shifts. This script identifies the exact moments of correlation decoupling—historically a lead indicator for major Bitcoin volatility and catch-up rallies.
THE IDEA: THE DECOUPLING SIGNAL
Traditional safe havens like Gold often act as a "Smoke Alarm" for geopolitical fear. Bitcoin, however, functions more as a "Fire Department" for global liquidity expansion. When the 52-week correlation between the two drops to zero or below, it signals a structural divergence.
Data from the past can suggest that such "Zero-Cross" events occur when Gold has front-run a price move, leaving Bitcoin at a relative valuation discount. This script marks these "Regime Shifts" (M-Markers) and measures the subsequent performance during a customizable Alpha Window.
CALCULATIONS & METHODOLOGY
The script utilizes the following logic to generate its data points:
• Purchasing Power Ratio: Calculated as Bitcoin Price divided by Gold Price. This shows exactly how many ounces of gold 1 BTC can buy.
• Pearson Correlation: A rolling 52-week calculation measuring the linear relationship between BTC and Gold prices.
• Zero-Cross Signal: A logic trigger/Marker that fires when the correlation value drops from a positive state to zero or a negative value.(M1 - M-n)
• Alpha Performance: A secondary calculation that captures the BTC price at the signal bar and compares it to the price exactly N-weeks later.
HOW TO READ THE CHART
• Orange Line: The current BTC/Gold ratio. A rising line means Bitcoin is gaining purchasing power against Gold.
• Orange Vertical Shapes (M-n): These mark the "M-Signals" where correlation broke (correlation ratio turned from positive to 0 or below on that bar). This is the "coiled spring" phase.
• Blue Vertical Shapes (Result): These appear after your defined Alpha Window (e.g., 12 weeks). They display the percentage change for both the Ratio and BTC/USD price since the M-n-signal.
• Blue Area (middle Lane): A visualization of the raw correlation value. When this cloud disappears toward the zero-level, a regime shift is in progress.
USER INPUTS
• Tickers: Choose your preferred Bitcoin and Gold sources (e.g., INDEX:BTCUSD or TVC:GOLD).
• Correlation Lookback: Default is 52 weeks, the institutional standard for measuring annual macro cycles.
• Alpha Window: Define the number of weeks (e.g., 12) you wish to track after a decoupling signal to verify historical catch-up trends.
TIMEFRAME
I view the data on the weekly timeframe. The script is optimized to run on this timeframe.
DISCLAIMER
This script is provided for educational and research purposes only. Correlation shifts are indicators of market structure changes and do not guarantee future price direction. Past performance of the BTC/Gold ratio is not an indicator of future results. Always use comprehensive risk management when trading high-volatility assets.
TAGS
Rob Maths, robmaths, Rob_Maths, Bitcoin, Gold, Ratio, Correlation, Macro
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.