31 Oct 2023, 19:56

Hello Forum!

I'm trying to build an EA but I'm having an issue with the tester on MT5 right from the first few blocks.
Funny enough, on the live market everything works fine and according to my expectations, at least at this early stage of building.
For some reason, the tester is not fully respecting Block #19, which is supposed to disable the buy function:

https://fxdreema.com/shared/1bPrMQl4b

Even though the log shows that the block has been disabled, the EA still immediately opens a new position.
Based on logs, it seems to me that the problem lies in the lack of time/tick delay in the tester and the EA sees both the disabled block and the condition to open a position at the same time:

sample.png

I've tried adding functions like "skip ticks" or "delay" after Block 18/19, but the tester completely ignores them and doesn't delay anything.

I did manage to create an "artificial" delay in the tester by adding a condition before the BUY block:

sample_2.png

and everything starts working as it should. Unfortunately, even such a small variable affects the tester results compared to when this variable is absent, rendering the entire backtesting meaningless.

So, my question is: how can I delay the BUY block in the tester so that the EA waits for at least 1 second before taking any action after the execution of Block #19?