Logic for 2-step signal verification EA

 

i'd like to code EA which has a 2 step signal , if something happens ( like a cross ma or anything ) , then wait for 1-5 candles to see if another behavior happens and only then give me the signal 

the problem i'm facing is that after the first check , i don't know how to keep the value static for 5 candles until i see a second confirmation since code updates every tick and value of first confirmation will disappear 

i thought of just check last 5 candles for both steps but the things is that the second confirmation can happen at any candle between number 1-5 and just doing loop doesn't seem like an effective way

i only need help with the logic or maybe just a pseudo code and i can handle the rest

 
any help plz?
 
andrw11:
any help plz?

A  method here :

https://www.mql5.com/en/forum/355161

https://www.mql5.com/en/forum/355161

moving average cross over + stochastic signal
moving average cross over + stochastic signal
  • 2020.11.07
  • www.mql5.com
hi all i'm trying to code the following condition (as below) I want to place an arrow the first time stoch crosses upwards the 50value, after sma20...