Change-Log 3.12
Current Version 3.12
Encapsulates error code and text handling.
Supported features:
Error code handling and error code resolving to text messages is a pain. This include file will solve some of the daily issues of handling error codes.
Example output:
This output was produced by ObjectGetInteger() in exaple code below.
Example code:
///////////////////////////////////////// // // Handle user specified warning codes // as errors. // #define LIB_ERR_LEVEL_WARNING_AS_ERROR #include <mqlplus/lib_error.mqh> /* ********************************************************************************************************* * Provider return codes * ********************************************************************************************************* */ // Define error group id #define EA_ERRGROUP_CODE_EA_CORE 0x01 // Defined return codes #define CORE_SUCCESS LIB_ERROR_CODE(EA_ERRGROUP_CODE_EA_CORE, 0x00) #define CORE_INFO_CORE_READY LIB_ERROR_CODE_HANDLED(EA_ERRGROUP_CODE_EA_CORE, 0x01) #define CORE_WARN_PENDING_OPERATION LIB_ERROR_CODE_WARNING(EA_ERRGROUP_CODE_EA_CORE, 0x01) // Define message resolver LIB_ERR_REGISTER_RESOLVER_BEGIN(EA_ERRGROUP_CODE_EA_CORE) LIB_ERR_REGISTER_RESOLVER_MSGCODE(CORE_SUCCESS, "CORE_SUCCESS", "Operation success. An order has been processed.") LIB_ERR_REGISTER_RESOLVER_MSGCODE(CORE_INFO_CORE_READY, "CORE_INFO_CORE_READY", "Expert advisor: Core ready.") LIB_ERR_REGISTER_RESOLVER_MSGCODE(CORE_WARN_PENDING_OPERATION, "CORE_WARN_PENDING_OPERATION", "A pending operation is awaiting confirmation.") LIB_ERR_REGISTER_RESOLVER_END(EA_ERRGROUP_CODE_EA_CORE) //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- // Set a user defined error code SetUserError(CORE_INFO_CORE_READY); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- // Perform some check check_for_pending_orders(); // Retrieve error code and display its text OnError(); //--- return; } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- // Retrieve the error code int err_code = NULL; // Update some state by function if( (some_function()) && (OnError(err_code)) ) // Display error message in journal and retrieve its corresponding error number { // Last error code is saved in err_code return; } // Continue processing //--- return; } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| check_for_pending_orders() | //+------------------------------------------------------------------+ void check_for_pending_orders() { //--- // Set a user defined error code SetUserError(CORE_WARN_PENDING_OPERATION); //--- return; } //+------------------------------------------------------------------+ //| some_function() | //+------------------------------------------------------------------+ bool some_function() { //--- // Error status bool err = false; // Perform some eventually failing operation err |= (!err) && !ObjectGetInteger(ChartID(), "", OBJPROP_COLOR) && OnError(__LINE__); // Set a user defined error code err |= (!err) && SetUserError(CORE_SUCCESS); //--- return(!err); }
MQL Plus Enhanced Debugging Support
An (optional) include file to enhance debugging experience.
Order - Deals - Position - Histroy
Get all your Deal, Positions and order Information to .csv Files. Ready for Excel import History is splitted in 3 files, Positions, Deals and Orders
HEX (Heikin Ashi Extended)
Extended version of the original Heikin Ashi indicator
AlgoX MA Channel
Version: 1.0