Adaptive Power Law Fitting by Dr. G. Santostasi

The BTC Power Law Model creates a linear fit by assuming a power law relationship between the Price and time (measured in days from the Genesis) block and therefore uses the log of the price and the log of time (that is rarely used in financial analysis) to perform the regression calculation. It turns out that this unusual but simple approach represents a surprisingly good long-term approximation of the BTC price (with an R^2=0.95).
While Dr. Santostasi is the creator of the model other Pinescripts exist using the methodology borrowed from his work. Dr. Santostasi inspected the code of these scripts and they are incorrect or they use a static formula for the fitting instead of doing the regression in real time based on current data. This is why this current script is called "adaptive".
It uses current data, cleans the data of large outliers using several statistical methods and creates an online robust fitting in the log-log space. It is also adaptive because instead of being only valid on a daily bar time frame it can be used at all time frames (even if daily is ideal).
The other existent scripts cannot be used in this way because they use a static method designed only for the daily time frame.
Another innovation of the current script is to identify deviation levels from the trend that are based on sound statistical methods. A log-normal distribution of the residuals is assumed (based on the actual distribution of the BTC deviations). These distributions then it is then used to determine possible resistance and support levels at the relevant scale chosen by the user.
The script also contains other relevant information like previous and the next halvings.
Furthermore, the script projects the prediction of the model to the future (again missing from most existing PL scripts) several bars in the future selected as a parameter by the user.
The BTC Power Law Model creates a linear fit by assuming a power law relationship between the Price and time (measured in days from the Genesis) block and therefore uses the log of the price and the log of time (that is rarely used in financial analysis) to perform the regression calculation. It turns out that this unusual but simple approach represents a surprisingly good long-term approximation of the BTC price (with an R^2=0.95).
While Dr. Santostasi is the creator of the model other Pinescripts exist using the methodology borrowed from his work. Dr. Santostasi inspected the code of these scripts and they are incorrect or they use a static formula for the fitting instead of doing the regression in real time based on current data. This is why this current script is called "adaptive".
It uses current data, cleans the data of large outliers using several statistical methods and creates an online robust fitting in the log-log space. It is also adaptive because instead of being only valid on a daily bar time frame it can be used at all time frames (even if daily is ideal).
The other existent scripts cannot be used in this way because they use a static method designed only for the daily time frame.
Another innovation of the current script is to identify deviation levels from the trend that are based on sound statistical methods. A log-normal distribution of the residuals is assumed (based on the actual distribution of the BTC deviations). These distributions then it is then used to determine possible resistance and support levels at the relevant scale chosen by the user.
The script also contains other relevant information like previous and the next halvings.
Furthermore, the script projects the prediction of the model to the future (again missing from most existing PL scripts) several bars in the future selected as a parameter by the user.
Invite-only script
Only users authorized by the author have access to this script, and this usually requires payment. You can add the script to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author — learn more here. For more details, follow the author's instructions below or contact Quantonomyfund directly.
Note that this private, invite-only script has not been reviewed by script moderators, and its compliance with House Rules is undetermined. TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.
Disclaimer
Invite-only script
Only users authorized by the author have access to this script, and this usually requires payment. You can add the script to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author — learn more here. For more details, follow the author's instructions below or contact Quantonomyfund directly.
Note that this private, invite-only script has not been reviewed by script moderators, and its compliance with House Rules is undetermined. TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Warning: please read our guide for invite-only scripts before requesting access.