OPEN-SOURCE SCRIPT
已更新 Liquidity Optimal Lag

1.0.
版本注释
This script is designed to assess the impact of liquidity from Federal Reserve operations on asset prices, allowing for customizable weightings and analysis of correlations between liquidity factors and selected assets like Bitcoin (BTC), Ethereum (ETH), or Solana (SOL). The primary objective is to understand how different liquidity inputs affect the price of these assets and to visualize correlations over time with adjustable settings.Key Features:
1. Liquidity Calculation with Adjustable Weightings:
- The script pulls data from the Federal Reserve's balance sheet and other relevant liquidity sources such as the Treasury General Account (TGA), Reverse Repo Payments (RRP), Bank Term Funding Program (BTFP), and the Discount Window.
- Users can experiment with different weightings for each liquidity factor, allowing for flexibility in how each component contributes to overall liquidity.
- The final liquidity figure is normalized for better comparison and can be offset by a user-defined period for improved lag analysis.
2. Correlation and Statistical Analysis:
- The script calculates the correlation (`r`) between the selected asset's price (BTC, ETH, or SOL) and the offset liquidity data over a customizable correlation period.
- Additionally, the R-squared (`r²`) value is computed to measure the strength of the relationship between liquidity and asset prices.
- Smoothing can be applied to the correlation data using a simple moving average (SMA), and both the raw and smoothed correlation values are plotted.
3. Customizable Inputs:
- Asset Selection: Choose between Bitcoin (BTC), Ethereum (ETH), or Solana (SOL) to compare their prices against the liquidity data.
- Weighting: Adjust weightings for the Fed Balance Sheet, TGA, RRP, BTFP, and Discount Window to experiment with how each liquidity source impacts the overall calculation.
- Correlation Settings: Fine-tune the correlation analysis using adjustable periods, smoothing, and an offset for liquidity.
- Display Options: Toggle the visibility of Net Fed Liquidity, Correlation, and Average Correlation on the chart.
4. Visual Representation:
- The script plots the following on the chart:
- Net Fed Liquidity: The offset and normalized liquidity value.
- Correlation: The correlation coefficient between liquidity and the asset price.
- Average Correlation: A smoothed version of the correlation using a moving average.
- A table in the top-right corner displays the real-time and average correlation (`r`) and R-squared (`r²`) values for easier interpretation.
This tool is ideal for traders and analysts interested in understanding the lag effect of liquidity on asset prices and experimenting with various liquidity weightings to find the optimal configuration.
版本注释
3.0开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。