Error Description

Error Description
Download ALL MT5 librarys (393)
YouTube Video Thumbnail

Similar MetaTrader Tools

Error Description

Info

The Error Description is a Library for MetaTrader 5 that the library contains the following functions:tradeserverreturncodedescription -returns description of trade server return codes;errordescription - returns description of runtime errors. //+------------------------------------------------------------------+ //| ErrorDescription.

Usage

This tool is typically used for enhancing chart analysis and decision making.

Platform

This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use Error Description

1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.

2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.

3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.

4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.

Frequently Asked Questions

Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.

Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.

Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.

What this tool does

The library contains the following functions:TradeServerReturnCodeDescription -returns description of trade server return codes;ErrorDescription - returns description of runtime errors.

Typical Use Case

This Library excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.

Description & Settings

Related: Result Retcode Description - another powerful library for MetaTrader 5 traders.


The library contains the following functions:

TradeServerReturnCodeDescription -
returns description of trade server return codes;

Also recommended: Error Desc - similar library with strong performance on MetaTrader 5.


ErrorDescription -
returns description of runtime errors.//+------------------------------------------------------------------+ //| ErrorDescription.mqh | //| Copyright 2010, MetaQuotes Software Corp. | //| | //+------------------------------------------------------------------+ #property copyright "2010, MetaQuotes Software Corp." #property link " #property version "1.00" //+------------------------------------------------------------------+ //| returns trade server return code description | //+------------------------------------------------------------------+ string TradeServerReturnCodeDescription(int return_code) //+------------------------------------------------------------------+ //| returns runtime error code description | //+------------------------------------------------------------------+ string ErrorDescription(int err_code)
Example:
(Don't forget to copy the file
ErrorDescription.mq5
to the folder \MetaTrader 5\MQL5\Include)
//+------------------------------------------------------------------+ //| ErrorDescrTest.mq5 | //| Copyright 2010, MetaQuotes Software Corp. | //| | //+------------------------------------------------------------------+ #property copyright "2010, MetaQuotes Software Corp." #property link " #property version "1.00" #include <ErrorDescription.mqh> //+------------------------------------------------------------------+ //| Example of use of the ErrorDescription.mqh library | //+------------------------------------------------------------------+ void OnStart() { Print("----- Description of trade server return codes -----"); for(int i=10004;i<=10034;i++) { Print("Trade server return code:",i,TradeServerReturnCodeDescription(i)); } Print("-------- Description of runtime error codes ---------"); for(int i=4001;i<=4014;i++) { Print("Runtime error code:",i,ErrorDescription(i)); } } //+------------------------------------------------------------------+
In some cases it's necessary to work with user defined errors. In MQL5 there is a function SetUserError, what sets the predefined variable _LastError into the value equal to ERR_USER_ERROR_FIRST + user_error.
The user defined error codes starts from code ERR_USER_ERROR_FIRST. In such cases you can use the function
ErrorDescriptionExt
to return description of errors, including the user defined errors:
//+------------------------------------------------------------------+ //| UserErrorDescr.mq5 | //| Copyright 2010, MetaQuotes Software Corp. | //| | //+------------------------------------------------------------------+ #property copyright "2010, MetaQuotes Software Corp." #property link " #property version "1.00" #include <ErrorDescription.mqh> //+------------------------------------------------------------------+ //| returns runtime error code description, | //| with user defined errors | //+------------------------------------------------------------------+ string ErrorDescriptionExt(int err_code,string&user_errors[]) { if(err_code>=0 && err_code<ERR_USER_ERROR_FIRST) return(ErrorDescription(err_code)); //--- user defined runtime errors err_code-=ERR_USER_ERROR_FIRST; if(err_code<=ArraySize(user_errors)) return(user_errors[err_code]); //--- return("Unknown error"); }; // an array with description of the user defined runtime errors string MyErrors[]= { "User error №1", "User error №2", "User error №3" }; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- for(int i=0;i<=2;i++) { SetUserError(i); Print("User defined error code:",i,ErrorDescriptionExt(GetLastError(),MyErrors)); } } //+------------------------------------------------------------------+

You may also like: MQ L Plus Enhanced Error Handler Support - excellent alternative for library users on MetaTrader 5.


Leave your opinion, ask a question, share some knowledge

Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators