TradingView
luca_badoer
19 de Abr. de 2023 13:26

BTCUSD Price prediction based on central bank liquidity 

Bitcoin / United States DollarCoinbase

Descripción

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.
Comentarios
GeorgePtur
Hello dear luka_badoer!
Your script is great, the only big request is to add CNCBBC*CNYUSD !
Thank you in advance!
luca_badoer
@GeorgePtur, added CNCBBS*FX_IDC:CNYUSD and updated slopes
GeorgePtur
@luca_badoer, Thank tou very much !
DeFi_Educator
Thanks for creating this! Have been looking into this as well after reading lots of arthur hayes articles over the last year :).

Am I correct by saying that CNY (China), UK (British Pound), SNB (Swiss National Bank) are missing in this?

Also came across a related script, it might help if you wanted to incorporate them:
tradingview.com/script/ZWFyMLe7-Central-Bank-Dark-Energy-Tracer/
luca_badoer
@DeFi_Educator, I'd love to re-run the regression including China, Swiss and UK central bank asset data. What I need is a reliable source of data for their assets. I'm struggling in particular with the China central bank data. If you can suggest a source like what I'm currently using (fred.stlouisfed.org/series/WALCL I'd be happy to incorporate them.
DeFi_Educator
@luca_badoer,
Not sure how impactful the Swiss and UK central bank data would be tbh, but def think it's worth adding china. Especially since china's reopening their central bank has been increasing their balance sheet big time. Think moving forward they'll likely play an ever more important role too.

For my personal Central bank chart I use the following:
WALCL+JPNASSETS*JPYUSD+CNCBBS*CNYUSD+ECBASSETSW*EURUSD-RRPONTSYD-WTREGEN

So CNCBBS*CNYUSD would need to be added
luca_badoer
@DeFi_Educator, The problem is accessing the China central bank balance sheet data programmatically to run the regression first. The FRED website doesn't have it. If you know where it can be obtained I would love to add it.
DeFi_Educator
luca_badoer
@DeFi_Educator, thank you for providing these suggestions. Out of the 3 Macrovar was the only one providing this data free of charge so that's the one I use to re-run the regression.
Más