Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Views:
712
Rating:
(5)
Published:
Updated:
\MQL5\Include\
test.mq5 (1.73 KB) view
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

This library uses short descriptive texts for each of the errors present in the MQL5 Reference. It will be updated frequently as new errors are constantly added to the official documentation

Last Update: 2024-02-29


Usage Example:

(Don't forget to copy the fileErrorDescription2.mq5 to the folder \MetaTrader 5\MQL5\Include)

     //+------------------------------------------------------------------+
    //|                                                         test.mq5 |
    //|                                   Copyright 2024, Paulo Henrique |
    //|                  https://www.mql5.com/en/users/pau1ohenrique.dev |
    //+------------------------------------------------------------------+
    #property copyright  "Copyright 2024, Paulo Henrique"
    #property link       "https://www.mql5.com/en/users/pau1ohenrique.dev"
    #property version    "1.00"
    
    // Includes
    #include <ErrorDescription2.mqh>
    
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    void OnStart()
      {
    //--- usage example #1
       Print("Description of MQL5 errors:");
       for(int i=FIRST_RUNTIME_ERROR; i<=LAST_TRADE_SERVER_ERROR; i++)
         {
          string error_desc=GetError(i);
          if(IsSuccess(i) || error_desc==NULL)
             continue;
          if(IsRuntimeError(i))
             Print("RuntimeError: ",error_desc);
          if(IsTradeServerError(i))
             Print("TradeServerError: ",error_desc);
          if(IsUserError(i))
             Print("UserError: ",error_desc);
         }
    //--- usage example #2
       Print("\nLast error description:");
       int retcode=GetLastError();
       if(!IsSuccess(retcode))
          Print(GetError(retcode));
    
    //--- or simply
       Print(GetError());
       // The operation completed successfully [0]
       // Unexpected internal error [4001]
       // ...
       Print(GetError(false));
       // The operation completed successfully
       // Unexpected internal error
       // ...
      }
    
    //+------------------------------------------------------------------+ 

    I will soon publish a library with a class that simplifies the use of errors in MQL5, including simplifying user error reporting using a Raise(my_error) method for example.



    Translated from Portuguese by MetaQuotes Ltd.
    Original code: https://www.mql5.com/pt/code/48431

    ONNX Trader ONNX Trader

    An example of a bot with an embedded machine learning model that is trained in python and saved in ONNX format.

    PACF_ACF PACF_ACF

    The script calculates the autocorrelation and partial autocorrelation functions and displays them on a graph

    Keyboard Keyboard

    Working with keyboard data

    AIS Extremum AIS Extremum

    The indicator allows you to estimate the probability that the price has reached its maximum or minimum.