Schau, wie man Roboter kostenlos herunterladen kann
Interessantes Skript?
Veröffentliche einen Link auf das Skript, damit die anderen ihn auch nutzen können
Hat Ihnen das Skript gefallen?
Bewerten Sie es im Terminal MetaTrader 5
Bibliotheken

MQL Plus Enhanced Debugging Support - Bibliothek für den MetaTrader 5

Ansichten:
587
Rating:
Stimmen: 6
Veröffentlicht:
2020.11.20 18:50
Aktualisiert:
2022.06.10 11:17
\MQL5\Include\MQLplus\

Current version: 4.85

- Minor bug fixes

Added/extended features

  • Conditional breakpoints
  • Enahnced MQL4-Compatibility


Current version: 4.3


Change-Log 4.3

  • Added all MQL5 known data types to the macro DBG_MSG_VAR() and DBG_STR_VAR()
  • Improved output formatting
  • Added trace call depth for functions and correct indenting of debug messages
  • Bugfixes include: 
  • return-macro can now be passed function calls as return value
  • Translation of DeInit-Reason, and automatic insertion in OnDeinit call
  • Multiple output format errors

Change-Log 1.06

  • Fix for VarDump macro
  • Minor fixes, typos...
  • Updated code style format


Defines macros for supporting debugging code.

Supports following features:

  • Debug string comments
  • VarDump variables and arrays
  • Different assert types
  • Trace
  • Conditional Breakpoints
  • Performance counters

All addons are freely configurable. All code inclusions have been done in preprocessor macros.

There is one known caveat within the definition of macros. The macro NULL does not work on preprocessor level, so it needs to be replaced. To work around the issue, you should cast the NULL makro like this: (double)NULL - Depending on the type being in use... string, int and so on...

Of course, the code is not fully complete and an assert usually includes a "try catch" but as they are not available, other techniques needed to be found to achieve at about a comparable result. Breakpoints will halt the code at that line, while you are debugging, pressing the F9-Key will make the debugger break into this exact location within the code. As close as possible, not the original.

All needed documentation is included in the header file.

All macros are optional, so the code below shows some of available macros. A full list and detailed description is included in the header file.

Example journal output:



Example Code:

#define LIB_DEBUG
#include <mqlplus/lib_debug.mqh>


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
/////////////////////////////////////
// Function debug trace code
#ifdef DBG_TRACE_ONINIT
#undef DBG_TRACE_ONINIT
#define DBG_TRACE_ONINIT(x) x
#define DBG_TRACE_ONINIT_RETURN(x) DBG_MSG_TRACE_RETURN_VAR(x)
#else
#define DBG_TRACE_ONINIT(x)
#define DBG_TRACE_ONINIT_RETURN(x) DBG_MSG_NOTRACE_RETURN_VAR(x)
#endif
/////////////////////////////////////
int OnInit()
  {
DBG_TRACE_ONINIT(
    DBG_MSG_TRACE_BEGIN;
    );
PERF_COUNTER_BEGIN;
//---
    int test = NULL;
    DBG_MSG_VAR(test);          

   
//---
   DBG_TRACE_ONINIT_RETURN(INIT_SUCCEEDED);
  }




//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
/////////////////////////////////////
// Function debug trace code
#ifdef DBG_TRACE_ONDEINIT
#undef DBG_TRACE_ONDEINIT
#define DBG_TRACE_ONDEINIT(x) x
#define DBG_TRACE_ONDEINIT_RETURN DBG_MSG_TRACE_RETURN
#else
#define DBG_TRACE_ONDEINIT(x)
#define DBG_TRACE_ONDEINIT_RETURN DBG_MSG_NOTRACE_RETURN
#endif
/////////////////////////////////////
void OnDeinit(const int reason)
  {
DBG_TRACE_ONDEINIT(
    DBG_MSG_TRACE_BEGIN;
    DBG_MSG_VAR(reason);
    );
PERF_COUNTER_BEGIN;
//---

    int test = NULL;
    DBG_MSG_VAR(test);

   DBG_TRACE_ONDEINIT_RETURN;
  }



//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

    int test = NULL;
    DBG_MSG_VAR(test);


    return;   
  }
//+------------------------------------------------------------------+
 
    Order - Deals - Position - Histroy Order - Deals - Position - Histroy

    Get all your Deal, Positions and order Information to .csv Files. Ready for Excel import

    Wilson Relative Price Channel - mod Wilson Relative Price Channel - mod

    Wilson Relative Price Channel - modifiziert

    MQL Plus Enhanced Error Handler Support MQL Plus Enhanced Error Handler Support

    An (optional) include file to enhance error code handling experience.

    HEX (Heikin Ashi Extended) HEX (Heikin Ashi Extended)

    Extended version of the original Heikin Ashi indicator