//@version=5 indicator("My script", overlay=true, max_lines_count=500) h = input.int(9, "Hour", minval=0, maxval=59) m = input.int(30, "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)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter