luca_badoer

BTCUSD Price prediction based on central bank liquidity

luca_badoer Actualizado   
In recent months the idea that Bitcoin prices are increasingly linked to liquidity provided by central banks has gained strength. Multiple opinion leaders in the bitcoin space have shared their thoughts to explain why this is happening and why it makes sense. Some of these people I'm talking about are Preston Pysh, Dr. Jeff Ross, Steven McClurg, Lynn Alden among others.

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.
Notas de prensa:
As per multiple requests I've added CNCBBS*FX_IDC:CNYUSD to the total liquidity calculation. Consequently I've had to run the regression again using the new liquidity figure. The new R2 is 90.48% down slightly from the previous 90.86%. The script has updated slope values, intercept and stdev to calculate the confidence lines. Thank you to the community for providing info on where to obtain China Central Bank balance sheet data to run the calculations.
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?