Download MetaTrader 5
To add comments, please log in or register
MQL5 language supports OpenCL. Try it!
jordan.baucke 2014.12.02 11:25 

I am attempting to set some breakpoints in my MQL4 EA running in the tester (gleaned from: and listed below)

The breakpoints work, but I cannot restart the test? And any subsequent attempts at starting a test do not run (blank visual mode chart) - I have to restart the terminal.

Any thoughts on how to restart the test after a breakpoint? And why my terminal might be freezing-

Terminal is IronFx (Build 745)

#include <WinUser32.mqh>
#import "user32.dll"
  int GetAncestor(int, int);
void PauseTest(){   datetime now = TimeCurrent();   static datetime oncePerTick;
    if( oncePerTick != now  )if( IsTesting()
    )if( IsVisualMode()     )if( IsDllsAllowed()    ){  oncePerTick = now;
        for(int i=0; i<200000; i++){        // Delay required for speed=32 (max)
            if (IsStopped()) break;         // WH-DL
            int main = GetAncestor(WindowHandle(Symbol(), Period()), 2);//GA_ROOT
            if (i==0) PostMessageA(main, WM_COMMAND, 0x57a, 0); // 1402. Pause
    }   }
    // The PostMessage above sends the command to the main terminal. Thus it
    // only affects the active chart window. To maximize a window for example
    // must activate it first.
    // See also SetForgroundWindow(h)
//Breakpoint neither receive nor send back any parameters
void BreakPoint()
   //It is expecting, that this function should work
   //only in tester
   if (!IsVisualMode()) return(0);
   //Preparing a data for printing
   //Comment() function is used as 
   //it give quite clear visualisation
   string Comm="";
   //Press/release Pause button
   //19 is a Virtual Key code of "Pause" button
   //Sleep() is needed, because of the probability
   //to misprocess too quick pressing/releasing
   //of the button
I know this is the MQL5 forum but the MQL4 forum is not as active / I have to wait for an account.
Breakpoints in Tester: It's Possible! - MQL4 Articles
Breakpoints in Tester: It's Possible! - MQL4 Articles: features of automated forex trading and strategy tester
marcelo marques pereira
marcelo marques pereira 2015.03.28 15:35  

Hi Guys! how are you?

In my case, using  build 765 , the first "pause"only worked after the EA had sent 5 orders  + "a couple of bars".. is there any with the same issue?

As you can see here



even though at 05:26 we got the  "pause" message, the EA ignored..

Thanks a million! 

Breakpoints in Tester: It's Possible!
Breakpoints in Tester: It's Possible!
  • 2007.08.15
  • Christo Tsvetanov
The article deals with breakpoint emulation when passed through Tester, debug information being displayed.
To add comments, please log in or register