Monday, July 21, 2025

Bitcoin Power Law Divergence Banana Zone (%) by JimSixOneEight (TradingView PineScript Indicator) Jim618

This is from https://x.com/JimSixOneEight/ (Jim618)... kudos!

**********

//@version=6
indicator("Bitcoin Power Law Divergence Banana Zone (%)", overlay=false)

//Bitcoin Power Law Divergence - JIM SIX ONE EIGHT - FREE, OPEN SOURCE, Just link to : https://x.com/JimSixOneEight

days_since_genesis = (time - timestamp("UTC", 2009, 1, 3, 0, 0, 0)) / (1000 * 60 * 60 * 24)

power_law = 0.0
if days_since_genesis > 1
    power_law := 2.88 * math.pow(days_since_genesis / 1000, 5.82)

divergence_percent = 0.0
if close > 0
    divergence_percent := ((close - power_law) / close) * 100


plot(divergence_percent, "Price Divergence (%)", color.purple, 2)

hline(0, "Zero Line", color.gray, hline.style_dashed)

// Define transparent colors for background fills
// Transparency is the 4th parameter (0-255, where 0 is fully transparent, 255 is fully opaque)
color_bg_red_60_80 = color.rgb(255, 100, 100, 50) // Light red for 60-80% band
color_bg_red_80_100 = color.rgb(200, 0, 0, 50)   // Medium red for 80-100% band
color_bg_red_above_100 = color.rgb(150, 0, 0, 50) // Dark red for above 100%

color_bg_green_60_80 = color.rgb(100, 255, 100, 50) // Light green for -60 to -80% band
color_bg_green_80_100 = color.rgb(0, 200, 0, 50)   // Medium green for -80 to -100% band
color_bg_green_below_100 = color.rgb(0, 150, 0, 50) // Dark green for below -100%

// Plot horizontal lines and store their IDs for filling
id_h60 = hline(60, "+60% Line", color.rgb(255, 50, 50), hline.style_solid)
id_h80 = hline(80, "+80% Line", color.rgb(200, 0, 0), hline.style_solid)
id_h100 = hline(100, "+100% Line", color.rgb(150, 0, 0), hline.style_solid)
id_h_top = hline(150, "", color.new(na, 100), display=display.none) // An invisible upper boundary for the top fill

id_h_minus60 = hline(-60, "-60% Line", color.rgb(50, 255, 50), hline.style_solid)
id_h_minus80 = hline(-80, "-80% Line", color.rgb(0, 200, 0), hline.style_solid)
id_h_minus100 = hline(-100, "-100% Line", color.rgb(0, 150, 0), hline.style_solid)
id_h_bottom = hline(-150, "", color.new(na, 100), display=display.none) // An invisible lower boundary for the bottom fill


// Fill between the fixed horizontal lines
// Positive zones
fill(id_h60, id_h80, color=color_bg_red_60_80, title="Fill 60-80%")
fill(id_h80, id_h100, color=color_bg_red_80_100, title="Fill 80-100%")
fill(id_h100, id_h_top, color=color_bg_red_above_100, title="Fill >100%") // Fill from 100% up to an arbitrary high point

// Negative zones
fill(id_h_minus60, id_h_minus80, color=color_bg_green_60_80, title="Fill -60 to -80%")
fill(id_h_minus80, id_h_minus100, color=color_bg_green_80_100, title="Fill -80 to -100%")
fill(id_h_minus100, id_h_bottom, color=color_bg_green_below_100, title="Fill <-100%") // Fill from -100% down to an arbitrary low point

**********

No comments:

Post a Comment

Thank you!

Bitcoin Power Law (by ChatGPT 5)

1) Tell me about the Bitcoin power law. Give me example graphs: I made three example graphs to illustrate different ways a power-law shows ...