Untitled
unknown
plain_text
a year ago
870 B
4
Indexable
//@version=5 indicator("60% Drop from All-Time High", overlay=true) // Input for the minimum percentage drop inputMinDropPercent = input.int(60, title="Minimum % Drop") // Calculate the all-time high of the selected symbol var float allTimeHigh = na if (bar_index == 0) allTimeHigh := high else allTimeHigh := math.max(high, allTimeHigh[1]) // Calculate the current price currentPrice = close // Calculate the percentage drop from all-time high percentDrop = ((allTimeHigh - currentPrice) / allTimeHigh) * 100 // Plot condition when the drop is greater than or equal to the input percentage plotshape(series=percentDrop >= inputMinDropPercent, title="60% Drop", location=location.belowbar, color=color.red, style=shape.labeldown, text="60% Drop") // Optional: plot the all-time high for reference plot(allTimeHigh, title="All-Time High", color=color.blue)
Editor is loading...
Leave a Comment