OPEN-SOURCE SCRIPT

Bitcoin Regression Price Boundaries

TLDR

DCA into BTC at or below the blue line. DCA out of BTC when price approaches the red line. There's a setting to toggle the future extrapolation off/on.


INTRODUCTION

Regression analysis is a fundamental and powerful data science tool, when applied CORRECTLY. All Bitcoin regressions I've seen (Rainbow Log, Stock-to-flow, and non-linear models), have glaring flaws ... Namely, that they have huge drift from one cycle to the next.

Presented here, is a canonical application of this statistical tool. "Canonical" meaning that any trained analyst applying the established methodology, would arrive at the same result. We model 3 lines:
  • Upper price boundary (red) - Predicted the April 2021 top to within 1%
  • Lower price boundary (green)- Predicted the Dec 2022 bottom within 10%
  • Non-bubble best fit line (blue) - Last update was performed on Feb 28 2024.


NOTE: The red/green lines were calculated using solely data from BEFORE 2021.


"I'M INTRUIGED, BUT WHAT EXACTLY IS REGRESSION ANALYSIS?"

Quite simply, it attempts to draw a best-fit line over some set of data. As you can imagine, there are endless forms of equations that we might try. So we need objective means of determining which equations are better than others. This is where statistical rigor is crucial.

We check p-values to ensure that a proposed model is better than chance. When comparing two different equations, we check R-squared and Residual Standard Error, to determine which equation is modeling the data better. We check residuals to ensure the equation is sufficiently complex to model all the available signal. We check adjusted R-squared to ensure the equation is not *overly* complex and merely modeling random noise.

While most people probably won't entirely understand the above paragraph, there's enough key terminology in for the intellectually curious to research.

DIVING DEEPER INTO THE 3 REGRESSION LINES ABOVE
WARNING! THIS IS TECHNICAL, AND VERY ABBREVIATED

We prefer a linear regression, as the statistical checks it allows are convenient and powerful. However, the BTCUSD dataset is decidedly non-linear. Thus, we must log transform both the x-axis and y-axis. At the end of this process, we'll use e^ to transform back to natural scale.

Plotting the log transformed data reveals a crucial visual insight. The best fit line for the blowoff tops is different than for the lower price boundary. This is why other models have failed. They attempt to model ALL the data with just one equation. This causes drift in both the upper and lower boundaries. Here we calculate these boundaries as separate equations.

Upper Boundary (in red) = e^(3.24*ln(x)-15.8)
Lower Boundary (green) = e^(0.602*ln^2(x) - 4.78*ln(x) + 7.17)
Non-Bubble best fit (blue) = e^(0.633*ln^2(x) - 5.09*ln(x) +8.12)
* (x) = The number of days since July 18 2010

Anyone familiar with Bitcoin, knows it goes in cycles where price goes stratospheric, typically measured in months; and then a lengthy cool-off period measured in years. The non-bubble best fit line methodically removes the extreme upward deviations until the residuals have the closest statistical semblance to normal data (bell curve shaped data).

Whereas the upper/lower boundary only gets re-calculated in hindsight (well after a blowoff or capitulation occur), the Non-Bubble line changes ever so slightly with each new datapoint. The last update to this line was made on Feb 28, 2024.


ENOUGH NERD TALK! HOW CAN I APPLY THIS?

In the simplest terms, anything below the blue line is a statistical buying opportunity. The closer you approach the green line (the lower boundary) the more statistically strong that opportunity is. As price approaches the red line, is a growing statistical likelyhood/danger of an imminent blowoff top.

So a wise trader would DCA (dollar cost average) into Bitcoin below the blue line; and would DCA out of Bitcoin as it approaches the red line. Historically, you may or may not have a large time-window during points of maximum opportunity. So be vigilant! Anything within 10-20% of the boundary should be regarded as extreme opportunity.

Note: You can toggle the future extrapolation of these lines in the settings (default on).


CLOSING REMARKS

Keep in mind this is a pure statistical analysis. It's likely that this model is probing a complex, real economic process underlying the Bitcoin price. Statistical models like this are most accurate during steady state conditions, where the prevailing fundamentals are stable. (The astute observer will note, that the regression boundaries held despite the economic disruption of 2020).

Thus, it cannot be understated: Should some drastic fundamental change occur in the underlying economic landscape of cryptocurrency, Bitcoin itself, or the broader economy, this model could drastically deviate, and become significantly less accurate.

Furthermore, the upper/lower boundaries cross in the year 2037. THIS MODEL WILL EVENTUALLY BREAK DOWN. But for now, given that Bitcoin price moves on the order of 2000% from bottom to top, it's truly remarkable that, using SOLELY pre-2021 data, this model was able to nail the top/bottom within 10%.
Bitcoin (Cryptocurrency)regressionstatistics

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור