Semafor/EMA crossover EA

 

Hi all,

I am having an issue making my ea enter trades. I have modified an EA to enter trades when one signal is printed and the given ema crossover occurs. " if(ZZ_1 > ZZ_2 && isCrossed == 2 && OrdersTotal() < 1) " is the statement I have written. The problem is that the crossover happens after the ZZ portion is printed therefore the two will never simultaneously be true. Is there a way to write this so that if the zz statement is true, a trade will be entered once the isCrossed is true, provided that the opposing zz statement is not triggered? The rest of the code works where orders are closed with the zz or stop loss/tp etc.

Thanks,