//@version=6 indicator("Workshop 07 Latest Bullish Gap", overlay=true) minimum = input.int(1, "Minimum gap ticks", minval=1) width = minimum * syminfo.mintick found = barstate.isconfirmed and low > high[2] + width var float bottom = na var float top = na var int created = na if found bottom := high[2] top := low created := bar_index touched = (not na(top) and bar_index > created and low <= top and high >= bottom) failed = (not na(bottom) and close < bottom and barstate.isconfirmed) plot(top, "Latest upper edge", color=color.blue, style=plot.style_stepline) plot(bottom, "Latest lower edge", color=color.gray, style=plot.style_stepline) plotshape(touched and barstate.isconfirmed, "Overlap", shape.circle, location.belowbar, color=color.orange, size=size.tiny) plotshape(failed, "Close below zone", shape.xcross, location.abovebar, color=color.red, size=size.tiny)