OPEN-SOURCE SCRIPT

First Candle +0.9% Line

91
//version=5
indicator("First Candle +0.9% Line", overlay=true)

// Capture the closing price of the first candle
var float first_candle_close = na

if (bar_index == 0)
first_candle_close := close

// Calculate the 0.9% level above the first candle's closing price
level = first_candle_close * 1.009 // 0.9% above the first candle close

// Plot the line at the calculated level
plot(series=level, color=color.red, linewidth=2, title="0.9% Above First Candle")

// Optional: Add a label to mark the level
if not na(first_candle_close)
label.new(x=bar_index, y=level, text="+0.9% Level", color=color.red, style=label.style_label_down, textcolor=color.white)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.