Untitled

 avatar
user_8870758
plain_text
8 months ago
904 B
75
Indexable
//@version=5
indicator("20% 30% 50% and 67% Fall from ATH", overlay=true)

// Calculate the all-time high (ATH)
var float ath = na
if high > ath or na(ath)
    ath := high

// Calculate the 20%, 30%, 50% and 67% levels from ATH
var float level20 = na
var float level30 = na
var float level50 = na
var float level67 = na
if not na(ath)
    level20 := ath * 0.80  // 20% fall from ATH
    level30 := ath * 0.70  // 30% fall from ATH
    level50 := ath * 0.50  // 50% fall from ATH
    level67 := ath * 0.33  // 67% fall from ATH
// Plotting the levels
plot(ath, color=color.black, linewidth=2, title="All-Time High")
plot(level20, color=color.green, linewidth=2, title="20% Fall from ATH")
plot(level30, color=color.blue, linewidth=2, title="30% Fall from ATH")
plot(level50, color=color.purple, linewidth=2, title="50% Fall from ATH")
plot(level67, color=color.red, linewidth=2, title="67% Fall from ATH")
Editor is loading...
Leave a Comment