MQL4 - automated forex trading   /  

Forum

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Debug for mq4

Back to topics list To post a new topic, please log in or register
avatar
59
Testing (Optimization) Technique and Some Criteria for Selection of the Expert Advisor Parameters

Testing (Optimization) Technique and Some Criteria for Selection of the Expert Advisor Parameters

There is no trouble finding the Holy Grail of testing, it is however much more difficult to get rid of it. This article addresses the selection of the Expert Advisor operating parameters with automated group processing of optimisation and testing results upon maximum utilisation of the Terminal performance capabilities and minimum end user load.

avatar
14020
RaptorUK 2012.10.12 17:20 #
 
jugivi:
Good afternoon, I wanted to know if there is some software that can do debug to mq4 program. Thank you.
Yes, Comment(), Print() & Alert() . . they are all you have.

avatar
59
jugivi 2012.10.12 17:23 #
 
Thanks, is what I'm using, but ...
avatar
8939
WHRoeder 2012.10.12 20:25 #
 
RaptorUK: Yes, Comment(), Print() & Alert() . . they are all you have.
  1. Which do not work under optimization. And DebugView which work always:
    /** Log
    * send information to OutputDebugString() to be viewed and logged by
    * SysInternal's DebugView (free download from microsoft) This is ideal for
    * debugging as an alternative to Print(). The function will take up to 10
    * stringa (or numeric) arguments to be concatenated into one debug message.
    //*/
    #import "kernel32.dll"
       void OutputDebugStringA(string msg);
    #import
    void Log(string s1,    string s2="", string s3="", string s4="", string s5="",
             string s6="", string s7="", string s8="", string s9="", string s10=""){
        if (IsDllsAllowed()){
            string out  = WindowExpertName() + ": "
                        + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
            OutputDebugStringA(out);
        }
    }
    
  2. An in the tester/visual mode you can call PauseTest()
    /*                                          PauseTest
    // http://forum.mql4.com/35112
    // Each chart consists of two windows (i.e. two hWnds): the drawing area (WH,)
    // and a container (GA.) There is then a standard MDI container which holds all
    // the chart windows (GA1.) And that sits inside the main MT4 window (GA2.)
    */
    #include <WinUser32.mqh>
    #import "user32.dll"
      int GetAncestor(int, int);
    #import
    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;         // http://forum.mql4.com/32837 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. http://forum.mql4.com/35336#538848
        // See also SetForgroundWindow(h) http://codebase.mql4.com/source/25962
    }
    

Back to topics list  

To add comments, please log in or register