OPEN-SOURCE SCRIPT
[c3s] CWS - M2 Global Liquidity Index & BTC Correlation

[c3s] CWS - M2 Global Liquidity Index with Offset BTC Correlation
This custom indicator visualizes and analyzes the relationship between the global M2 money supply and Bitcoin (BTC) price movements. It calculates the correlation between these two variables to provide insights into how changes in global liquidity may impact Bitcoin’s price over time.
Key Features:
Inputs:
Usage:
Ideal for traders and analysts seeking to understand the relationship between global liquidity and Bitcoin price. The offset and lookback period can be adjusted to explore different timeframes and correlation strengths, aiding more informed trading decisions.
This custom indicator visualizes and analyzes the relationship between the global M2 money supply and Bitcoin (BTC) price movements. It calculates the correlation between these two variables to provide insights into how changes in global liquidity may impact Bitcoin’s price over time.
Key Features:
- Global M2 Liquidity Index Calculation:
Fetches M2 money supply data from multiple economies (China, US, EU, Japan, UK) and normalizes using currency exchange rates (e.g., CNY/USD, EUR/USD).
Combines all M2 data points and normalizes by dividing by 1 trillion (1e12) for easier visualization. - Offset for M2 Data:
The offset parameter allows users to shift the M2 data by a specified number of days, helping track the influence of past global liquidity on Bitcoin. - BTC Price Correlation:
Computes the correlation between shifted global M2 liquidity and Bitcoin (BTC) price, using a 52-day lookback period by default. - Correlation Quality Display:
Categorizes correlation quality as:
Excellent: Correlation >= 0.8
Good: Correlation >= 0.6 and < 0.8
Weak: Correlation >= 0.4 and < 0.6
Very Weak: Correlation < 0.4
Displays correlation quality as a label on the chart for easy assessment. - Visual Enhancements:Labels: Displays dynamic labels on the chart with metrics like M2 value and correlation.
Plot Shapes: Uses shapes to indicate data availability for global M2 and correlation.
Data Table: Optionally shows a data table in the top-right corner summarizing:
Global M2 value (in trillions)
The correlation between global M2 and BTC
The correlation quality - Optional Debugging:Debug plots help identify when data is missing for M2 or correlation, ensuring transparency and accurate functionality.
Inputs:
- []Offset: Shift the M2 data (in days) to see past liquidity effects on Bitcoin.
[]Lookback Period: Number of periods (default 52) used to calculate the correlation.
[]Show Labels: Toggle to show or hide labels for M2 and correlation values.
[]Show Table: Toggle to show or hide the data table in the top-right corner.
Usage:
Ideal for traders and analysts seeking to understand the relationship between global liquidity and Bitcoin price. The offset and lookback period can be adjusted to explore different timeframes and correlation strengths, aiding more informed trading decisions.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。