What i need is as the day/month/week starts, i want horizontal lines on High and Low both if next candle doesnt break previous candle high and low otherwise it will keep checking untill high and low doesnt break… if it breaks low but doesnt break high then previous plot horizontal line til day end and when low is not broken, then plot horizontal line till day end on previous candle low …Kindly help
indicator("HiLo", overlay=true, max_lines_count=500)
h = input.int(9, "Hour", minval=0, maxval=59)
m = input.int(15, "Hour", minval=0, maxval=59)
var float first_high = na
var bool can_draw = false
var line l = na
is_new_session = (hour == h) and (minute == m)
bgcolor(is_new_session ? color.new(color.green, 85) : na)
if (is_new_session) // New session
first_high := high // Reset session high
can_draw := true // We are allowed to draw a line
l := line.new(bar_index, first_high, bar_index, first_high, color=color.red) // Get new line id
else
if (can_draw)
if (high > first_high) // New high is made
can_draw := false // Stop drawing
else
line.set_x2(l, bar_index) // Update x2 position of the line (move it to the right)
New contributor
Pankaj is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.