Crossover precision

 
In developing a crossover EA, how do I ensure the cross is complete. I tried to create an EMA crossover and realized that sometimes the trade will still happen even if the MAs are close but have not crossed. I would be grateful for the help
 
Darkwah: In developing a crossover EA, how do I ensure the cross is complete. I tried to create an EMA crossover and realized that sometimes the trade will still happen even if the MAs are close but have not crossed. I would be grateful for the help
If your require a detailed answer then you will have to show the code you have the issue with. We cannot read your mind or see your computer.
 
Darkwah: how do I ensure the cross is complete.

It is complete when the candle is complete. Look at bars one and two.

Reason: