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
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。