OPEN-SOURCE SCRIPT
Giovanni's Power Law Model | Astral Vision

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 📊
Inputs 🎛️
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.
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の精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
My premium indicators are available on Whop:
whop.com/astralvision
Astral Vision 🌠💠
whop.com/astralvision
Astral Vision 🌠💠
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
My premium indicators are available on Whop:
whop.com/astralvision
Astral Vision 🌠💠
whop.com/astralvision
Astral Vision 🌠💠
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。