//@version=6 indicator("Workshop 02 Trend", overlay=true) length = input.int(20, "Prior bars", minval=2) smooth = input.int(50, "Trend average", minval=2) boundary = ta.highest(high, length)[1] average = ta.sma(close, smooth) ready = bar_index >= math.max(length, smooth) candidate = close > boundary and close > average signal = ready and candidate and barstate.isconfirmed plot(boundary, "Prior high", color=color.gray) plot(average, "Trend average", color=color.blue) plotshape(signal, "Qualified close", shape.triangleup, location.belowbar, color=color.green, size=size.tiny) alertcondition(signal, "Qualified close", "Workshop trend condition on {{ticker}} {{interval}}")