OPEN-SOURCE SCRIPT

Giovanni's Power Law Model | Astral Vision

1 258
Giovanni's Power Law Model | Astral Vision 🌠💠

This indicator implements the Bitcoin Power Law model as formalized by physicist Giovanni Santostasi, which models Bitcoin's long-term price trajectory as a power function of the number of days elapsed since the genesis block. Unlike standard log-linear regression applied directly to price, this implementation uses a configurable root transformation of price before fitting, which allows the user to explore how the statistical quality of the power law relationship changes depending on which power of price is used as the dependent variable.

Calculation ⚙️

The number of days elapsed since the genesis block (January 3, 2009) is computed for each bar. Both the day count and price are transformed logarithmically: the X variable is log(days), and the Y variable is log(price^(1/k)), where k is a configurable integer exponent. This is equivalent to fitting the relationship log(price) = k × (slope × log(days) + intercept), meaning the model regresses log(price^(1/k)) against log(days) and then raises the result to the power k to recover the price-scale fit.

The regression is computed from scratch using ordinary least squares via cumulative sums of X, Y, XY, X², and Y² accumulated across all valid historical bars, then solved analytically at each bar using the standard OLS closed-form solution: slope = (n × ΣXY − ΣX × ΣY) / (n × ΣX² − (ΣX)²) and intercept = (ΣY − slope × ΣX) / n. This produces a true full-history regression that updates on every bar as new data is added, without any approximation.

The fitted price at each bar is: fitPrice = exp(intercept + slope × log(days))^k. Upper and lower bands are then derived by multiplying or dividing the fitted price by configurable band multipliers raised to the power k, ensuring the bands maintain consistent proportional spacing in the transformed space rather than in raw price terms. The R² coefficient of determination is computed at the last bar by comparing the explained variance of the regression against the total variance of the Y variable, quantifying how well the power law model fits the full historical data.

Plots 📊
  • Central power law regression line in neutral color
  • Two upper bands with fill between them, colored with the positive theme color
  • Two lower bands with fill between them, colored with the negative theme color
  • Table displaying the current k exponent and the R² goodness-of-fit statistic


Inputs 🎛️
  • K Exponent: the root applied to price before regression, between 1 and 7; higher values compress the price scale more aggressively
  • Upper Band 2 and Upper Band 3: multipliers for the two upper bands
  • Lower Band 2 and Lower Band 3: multipliers for the two lower bands


Colors 🎨
5 Astral Vision presets + custom override. Default: Hermes.

Purpose 🎯
Standard log-linear regression on Bitcoin price assumes a fixed exponential relationship between time and price. Giovanni Santostasi's formulation derives the power law from first principles of network science and thermodynamics, arguing that Bitcoin's adoption follows the same scaling laws observed in physical and biological systems. The configurable k parameter allows direct exploration of which root transformation produces the tightest regression, with the displayed R² providing an objective statistical measure of fit quality rather than a visual approximation. The OLS computation across the full price history from genesis makes the fitted line anchored to the entire dataset rather than to a recent window, producing a structurally stable long-term reference.

Disclaimer ⭕️
This indicator is for informational and educational purposes only. It does not constitute financial advice. Past performance is not indicative of future results. Always do your own research before making investment decisions.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。