The reality is that the correlation between market liquidity, measured as Assets held by the Federal Reserve, Bank of Japan and European Central bank, and Bitcoin prices is high. This made me wonder whether a regression between "market liquidity" and BTCUSD prices made sense in order to understand where Bitcoin prices are in relation to the liquidity in the market. After several trials I ended up fitting a polynomial regression of degree 5 between Market Liquidity and BTCUSD prices since 2013. This regression resulted in r-squared value of 90.93%. I initially visualized the results in python notebooks but then I thought it would be cool to be able to see them in real-time in tradingview.
That's where this script comes handy...
This script takes the coefficients and intercept from the polynomial regression I built and applies them to the "market_liquidity" index. In addition, it adds upper and lower bound lines to the prediction based on a 95% confidence interval. As you will see, particularly since 2020, the price of bitcoin has rarely been above or below the lines representing the 95% confidence interval. When price has actually crossed these lines it's been in moments where Bitcoin was highly overbought or oversold. Therefore this indicator could be used to understand when it's a good moment to enter or exit the market based on central bank fundamentals.
Here's the detailed step-by-step description of what the script does
1) It defines the coefficients obtained from running the regression betweeen "market liquidity" and BTCUSD. Market liquidity is defined as:
Market liquidity = FRED:WALCL + FX_IDX:JPYUSD*FRED:JPNASSETS + FX:EURUSD*FRED:ECBASSETSW - FRED:RRPONTSYD - FRED:WTREGEN
2) It defines a scale factor. The reason for this is that coefficients from the regression are very small numbers, given the huge numbers of the value of assets held by central banks. Pinescript doesn't support numbers with many decimals and rounds them to 0, so the coefficients had to be scaled up in order to be able to calculate the regression results.
3) It calculates market liquity with the formula defined above. Market liquidity is calculated in US Dollars.
4) It calculates the predicted BTCUSD price based on the coefficients and the market liquidity values.
5) It scales down the values by the same factor used to scale the coefficients up
6) It defines the standard deviation of the "potential_btcusd_price_scaled" and the actual BTCUSD prices.
7) It defines upper and lower bounds to the BTCUSD price prediction using a z-score of 1.96, which is equivalent to 95% confidence interval.
8) Lastly it plots the BTCUSD price prediction (orange) and the upper (red) and lower(green) confidence intervals.
The script can be updated as the correlation of BTCUSD to central bank assets changes (the slope values can be updated).
How to use it:
When actual BTCUSD price (blue line in the chart) crosses over the red line (upper bound) or crosses under the green line (lower bound) it should be taken as a sign that the price of BTCUSD may be overvalued or undervalued based on the value of assets held by major central banks.
Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.