@umbrellamaker
In this example, you have 3 variables that will take the value of the 3 last tops preceding their relative MA cross: https://fxdreema.com/shared/CcPfiN0me
This loop "search" in the past once.
@umbrellamaker Maybe (just maybe) because you are testong the 1 minute chart some repainting is happening with that MA. Try with hifher timeframes to confirm it works correctly.