Pause/Unpause Tester using EA

 
Does anyone know how to use an EA to pause/unpause tester?
I want whatever tests are running to be paused when the EA is trying to make a trade..
Then when the trade is complete, I need it to unpause and resume testing.
 
heyarn:
Does anyone know how to use an EA to pause/unpause tester?
I want whatever tests are running to be paused when the EA is trying to make a trade..
Then when the trade is complete, I need it to unpause and resume testing.

Your best solution may be a slightly roundabout route. For example, the following will halt the backtesting by displaying a message once it reaches the thousandth simulated tick. While the message box is being displayed on screen, you can then click on the backtesting's pause button. When you clear the message box, backtesting will then not continue until you un-pause the backtesting. (This works because MT4 suppresses its own built-in MessageBox function during backtesting, but not the MessageBox function in the Win32 API).

#import "user32.dll"
   int MessageBoxA(int Ignore, string Caption, string Title, int Icon);
#import

int start()
{
   static int TickCount = 0;
   TickCount++;
   Comment("Ticks: " + TickCount);
   if (TickCount == 1000) {
      MessageBoxA(0, "Got the 1000th tick!", "Pause...", 64);
   }
   return(0);
}
 
jjc:

Your best solution may be a slightly roundabout route. For example, the following will halt the backtesting by displaying a message once it reaches the thousandth simulated tick. While the message box is being displayed on screen, you can then click on the backtesting's pause button. When you clear the message box, backtesting will then not continue until you un-pause the backtesting. (This works because MT4 suppresses its own built-in MessageBox function during backtesting, but not the MessageBox function in the Win32 API).


Thanks jjc.. I was thinking of actually calling an exe macro to move the mouse to go and click on pause.. but i'll try this for now.

Reason: