I've been working on this for the past week but can't see if figure out how to do this in Pine. When only the most recent occurrence of a condition is true, how do I identity and reference the past 8 previous candle highs which is higher than the high[1] (ie, the candle prior to the trigger in my screenshot)? They don't have to be higher highs. The high of the historical candle must just be higher than the trigger -1 candle. Hopefully this makes sense.
I've tried using for loops, valuewhen(), and a few other things but can't seem to get it to work.