Tuesday, March 4, 2025

Bitcoin Power Law Code for TradingView (Pine Editor Pinescript) by @apsk32

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: 





No comments:

Post a Comment

Thank you!

Instead of being 40 and wishing you were 20 again... imagine you are 90 years old

Instead of being 40 and wishing you were 20 again, imagine you are 90 years old, looking back at yourself today. What would you tell yoursel...