Step 1: Copy/paste this code into the Pine Editor window and click save.
//@version
=6
indicator("Power Law", overlay=true)
// Days X-Axis Value
start = time == timestamp(2010, 7, 18, 0, 0)
days = request.security('INDEX:BTCUSD', 'D', ta.barssince(start))
offset = 561 // days between 2009/1/3 and "start"
d = days + offset
a = input(-17.668, 'Power Law Intercept',group = "Power Law Settings")
b = input(5.926, 'Power Law Slope',group = "Power Law Settings")
price_power_law_0 = math.pow(10, a + b * math.log10(d))
price_power_law_1 = math.pow(10, a + b * math.log10(d+1*365))
price_power_law_2 = math.pow(10, a + b * math.log10(d+2*365))
price_power_law_3 = math.pow(10, a + b * math.log10(d+3*365))
price_power_law_4 = math.pow(10, a + b * math.log10(d+4*365))
price_power_law_5 = math.pow(10, a + b * math.log10(d+5*365))
p0 = plot(price_power_law_0, color=#ffffffaa, title='Power Law',linewidth = 1)
p1 = plot(price_power_law_1, title='Power Law 1',linewidth = 1, color=bar_index % 2 == 0 ? #ffffffaa : #00000000)
p2 = plot(price_power_law_2, title='Power Law 2',linewidth = 1, color=bar_index % 2 == 0 ? #ffffffaa : #00000000)
p3 = plot(price_power_law_3, title='Power Law 3',linewidth = 1, color=bar_index % 2 == 0 ? #ffffffaa : #00000000)
p4 = plot(price_power_law_4, title='Power Law 4',linewidth = 1, color=bar_index % 2 == 0 ? #ffffffaa : #00000000)
p5 = plot(price_power_law_5, title='Power Law 5',linewidth = 1, color=bar_index % 2 == 0 ? #ffffffaa : #00000000)Step 2: Go to "Indicators" "Personal" and select the "Power Law" script. The years ahead metric should now be displayed.
************************************************
Credit:
- All goes to APSK32 on X/Twitter.
- The original post is https://x.com/apsk32/status/1891203202017644943