The best feasible option IMHO would be to break the whole process into 3 phases, each of which can run in batches.
1) Process all M1 bars and save the output data for an external program ( non-trading mode , call it "collect statistics");
2) Process the output data with an external program and generate a set of corresponding responses (you can mark the input data/responses with some hashes tied to timestamps - then your EA will work online and during tests in the same way, with an agreed algorithm/source code);
3) Run the backtest again - this time the EA should detect ready response data for every M1 bar and work seamlessly, without the need for pause/resume (trading mode).
The better yet - consider embedding the external program logic into MQL5 EA itself. What's the external program, that its algorithm can not be ported to MQL5?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
My MT5 EA is creating a file that will be read by an external system, and then that system creates a response file that my EA reads.
This process happens once per M1 bar and takes about 1-2 seconds, so when running live, timewise there is plenty of margin.
The problem occurs when running a backtest in Strategy Tester. The external system still needs 1-2 seconds, and even if I have a loop that checks for the return file, it will miss many candles, since with the higher backtest speed, many bars will pass while my EA is waiting for the response file for 1-2 seconds. I know I can slow down the backtest, but if I slow it down enough to know that no candles will be missed, it will take forever to run a test
So what I would like to do, programmatically, is to:
1. Pause the backtest, or change the speed to the lowest speed possible
2. Wait (with a loop) for the response file and read it
3. Unpause the test, or change the speed to the highest spied possible
I have tested pausing with the space key command, but that seems to be far too slow.
I have tested using DebugBreak, but I don't know of any way to programmatically Resume the test.
If someone has the solution to this, it would be very appreciated.
Thanks