Decompilation ex4 to mq4 is it necessary? Ex5 To Mq5 Decompiler. Ex4 to Mql4 converter
InfoPad, Online Information Panel for MetaTrader
Description
Error Codes
Error Codes in MetaTrader are crucial for identifying and resolving issues in the platform’s operations. The function GetLastError() retrieves these codes, and constants for these errors are defined in the stderror.mqh file.
To output descriptive text messages, the ErrorDescription() function, located in stdlib.mqh, can be used.
Errors may originate from the trade server or the client terminal.
As a specialist in MT4 and MT5 advisor programming, I frequently receive questions about such errors.
In response, I will explain the most common mistakes made by traders and Expert Advisors, their causes, and how to resolve them.
Every Expert Advisor operates differently, but many issues arise from a common set of problems.
Let’s explore the typical errors and their solutions, following the style of “Guidelines for Electronic Engineering Errors.”
A concise list of these errors can be found in the Error Codes reference, as well as in the MetaTrader 4/MetaTrader 5 terminal. We will use these resources to diagnose and solve problems effectively.
If your error isn’t listed or the suggested solutions don’t work, it’s advisable to contact the author of your Expert Advisor.
Before doing so, however, be sure to review the log files for further details about the issue.
Also i recommend read our FAQ
Some articles may also help you:
- FAQ: Answers to the most popular questions
- Testing and Optimization of Expert Advisors
- How to Install an Expert Advisor
Common Errors and How to Solve Them
Error Number | Brief Description | Possible Causes | Solution Method |
---|---|---|---|
Graph Mismatch Errors | Errors on the DC server: incoming ticks are not processed accurately across all timeframes. | 1. The DC server inaccurately processes incoming ticks across various timeframes. | 1. Testing immediately after loading from the archive does not reveal errors, as only minute data is loaded. Mismatches accumulate when live quotes start arriving. |
TestGenerator: Unmatched Data Error | Error in the quotes archive data |
1. Incomplete data from your broker 2. Corrupted quote database 3. Testing the EA using outdated data 4. Asynchronous data from older timeframes | An error occurs either when the data mismatch is not defined or when there is none. |
Error 0 or 1 | No error or the error is unknown | 1. Previous unresolved errors from a persistent request | Do not handle errors 0 and 1 in the Expert Advisor. |
Error 4, 146 (10022 in MT5) | The broker prohibits the use of an order expiration date | 1. The trade server is busy 2. You have set the wrong expiration type of the pending order (order cancellation time) | 1. Restart the terminal Optimize the EA code with better error handling functions 2. StopOrderDayToExpiration: – 0 – ORDER_TIME_GTC The order will be in the queue until it is removed ; – 1 – ORDER_TIME_DAY The order will be valid only for the current trading day; – X – ORDER_TIME_SPECIFIED The order will remain valid until the expiry date. or StopOrderBarToExpiration |
Error 8, 141 (10024 in MT5) | Too Frequent Requests |
1. The EA sends too many orders simultaneously 2. The EA does not wait for a server response before sending a new order, causing server overload | 1. Ensure the EA waits for responses before sending additional orders. 2. Expert Advisor has sent too many requests. Please wait a bit and continue working with Expert Advisor. |
Error 130, 145 (10016 in MT5) | Incorrect Stop Levels Specified | Stop levels (StopLoss, TakeProfit) are too close to the current price | 1. Verify the opening rules with your broker for Minimal StopLevel 2. Ensure stop levels comply with your account and broker’s specifications 3. You can use our function: SetMinStops – Automatically normalize all parameters of the Expert Advisor to the minimum acceptable stop levels. 4. Please set higher level of Stop parametrs StopLoss, TakeProfit, TrailingStop, Order Distance …. |
Error 132 (10018 in MT5) | The Market is Closed | The market is closed, usually on weekends | Try placing the trade after the market reopens. To trade in weekends you can try our TesterPad |
Error 133 (10017 in MT5) | Trading is Prohibited |
1. Trading is currently restricted 2. Trading is prohibited for the selected currency pair | 1. Wait for trading to resume 2. Try trading a different currency pair or check if a suffix is required for your pair |
Error 134 (10019 in MT5) | Not Enough Funds to Complete the Transaction | 1. The lot size you are trying to open is too large, leading to insufficient margin | 1. Check your free margin 2. Calculate the necessary funds for the desired lot size before opening the position 3. Check your trading lot settings (Lot, Autolot, DynamicLot, Martin) |
Error 135–138 (10004, 10006, 10020 in MT5) | The Price Has Changed |
1. Requote occurred 2. Market volatility 3. Broker does not allow trades at the stated price | 1. Avoid trading during volatile market periods 2. Increase slippage, but be aware that this may result in trades executed at different prices 3. This is a standard mistake of the fast market. |
Error 147 | ERR TRADE EXPIRATION DENIED | The EA or user attempts to set a pending order expiration date | Set the expiration date to 0 in the OrderSend function of the EA. The use of order expiration date is prohibited by the broker |
Error 148 (10033 in MT5) | Maximum Open or Pending Orders Reached | The maximum limit of open orders or pending positions has been reached | Check your broker’s limit for open orders and adjust your trading strategy accordingly. |
Error 4012, 4013 | Division by Zero Zero Devide |
1. The EA attempts to divide by zero in its calculations 2. MarketInfo(Symbol(), MODE_SPREAD) may return zero for brokers with floating spreads | Check the EA code to prevent division by zero and ensure proper handling of MarketInfo responses. |
Error 4017 | DLL Call Not Allowed | Calling a DLL is prohibited by the terminal or antivirus software | 1. Allow DLL calls through the terminal settings 2. Ensure the DLL is safe using antivirus software before enabling it |
Error 4106 | Unknown Symbol | The symbol is not listed in the Market Watch | Enable the symbol in Market Watch or request it from your broker. |
Error 4108 (10036 in MT5) | Invalid Ticket Number | The order’s ticket number no longer exists The order may have been closed manually or by another EA | Avoid manual intervention in EA-managed orders and disable conflicting EAs. Perhaps the Expert Advisor is trying to close or modify an order that has already been closed by another Expert Advisor. |
Error 4110, 4111 (10042,10043,10044 in MT5) | Long/Short Positions Not Allowed | The EA settings restrict certain trade types Server limit type of position | Adjust the settings in the General tab to allow the desired trade types (Long & Short, Only Long, Only Short for MT4 only). Ask your broker |
Error 10030 | TRADE RETCODE INVALID FILL | Incorrect filling of orders. | Set the parameter in the Expert Advisor settings TypeFilling The type of fill positions and orders. It is used for the MT5 terminal. In AUTO mode, the Expert Advisor tries to determine the fill type automatically. But, in some situations, you need to set the fill type yourself. |
TRADE ERROR CODES
Error Codes Returned from the Trade Server
The Code | Identifier | Description | Solution Method |
---|---|---|---|
10004 | TRADE_RETCODE_REQUOTE | Requote | Increase the slippage level or avoid trading during high volatility periods. Slippage The level of the maximum possible deviation in price when opening and closing positions (in Points). |
10006 | TRADE_RETCODE_REJECT | Request Denied | Check the trade conditions and account status, and retry the request later. |
10007 | TRADE_RETCODE_CANCEL | Request Canceled by Trader | Ensure that no manual cancellation is occurring or adjust the EA settings. |
10008 | TRADE_RETCODE_PLACED | Order Placed | No action required. This is a confirmation message. |
10009 | TRADE_RETCODE_DONE | Application Completed | No action required. The request has been successfully completed. |
10010 | TRADE_RETCODE_DONE_PARTIAL | Application Partially Completed | Check the remaining order and complete it manually if necessary. |
10011 | TRADE_RETCODE_ERROR | Request Processing Error | Review the logs to identify the error and retry the request after correction. |
10012 | TRADE_RETCODE_TIMEOUT | Request Canceled Due to Timeout | Increase the timeout period or retry during periods of lower server load. |
10013 | TRADE_RETCODE_INVALID | Bad Request | Check the request parameters and retry with correct values. |
10014 | TRADE_RETCODE_INVALID_VOLUME | Incorrect Volume in the Request | Ensure the trade volume is within the allowable limits for the account. |
10015 | TRADE_RETCODE_INVALID_PRICE | Wrong Price in the Request | Check the market price and retry with the correct one. |
10016 | TRADE_RETCODE_INVALID_STOPS | Wrong Stops in the Request | Ensure that the StopLoss and TakeProfit values comply with broker rules. SetMinStops Automatically normalize all parameters of the Expert Advisor to the minimum acceptable stop levels. |
10017 | TRADE_RETCODE_TRADE_DISABLED | Trade Prohibited | Check the trading conditions on the account and broker’s restrictions. |
10018 | TRADE_RETCODE_MARKET_CLOSED | The Market is Closed | Wait until the market reopens to place a trade. To trade in weekends you can try our TesterPad |
10019 | TRADE_RETCODE_NO_MONEY | Not Enough Funds to Fulfill the Request | Ensure sufficient funds in the account or reduce the trade size. |
10020 | TRADE_RETCODE_PRICE_CHANGED | Prices Have Changed | Retry the request with the updated price or increase slippage allowance. |
10021 | TRADE_RETCODE_PRICE_OFF | No Quotes to Process Request | Wait for the market to provide quotes and retry the request. |
10022 | TRADE_RETCODE_INVALID_EXPIRATION | Invalid Order Expiration Date in the Request | Set the correct expiration date or leave it blank for immediate orders. StopOrderDay ToExpiration = number of days for the order expiration. |
10023 | TRADE_RETCODE_ORDER_CHANGED | Order Status Has Changed | Update the order status and retry the request with the correct information. |
10024 | TRADE_RETCODE_TOO_MANY_REQUESTS | Too Frequent Requests | Limit the number of requests per second to avoid overloading the server. |
10025 | TRADE_RETCODE_NO_CHANGES | No Changes in the Request | Ensure there are actual changes before resubmitting the request. |
10026 | TRADE_RETCODE_SERVER_DISABLES_AT | Ask your broker | |
10027 | TRADE_RETCODE_CLIENT_DISABLES_AT | The Client Terminal Prohibits Auto Trading | Enable auto trading in the terminal settings to proceed with trades. |
10028 | TRADE_RETCODE_LOCKED | There is Already a Closing Order for the Specified Position. It May Occur When Working in a Hedging System Request Blocked for Processing | Wait for the current closing order to process before submitting another. Check for locked orders or system restrictions and resolve the issue. |
10029 | TRADE_RETCODE_FROZEN | Order or Position is Frozen | Contact your broker to understand why the position is frozen. |
10030 | TRADE_RETCODE_INVALID_FILL | An Unsupported Order Execution Type by Balance was Specified | Ensure the correct order execution type is chosen for your balance. TypeFilling The type of fill positions and orders. It is used for the MT5 terminal. In AUTO mode, the Expert Advisor tries to determine the fill type automatically. But, in some situations, you need to set the fill type yourself. |
10031 | TRADE_RETCODE_CONNECTION | The Request to Activate a Pending Order was Rejected, and the Order Itself was Canceled | Check the connection to the server and retry the request. |
10032 | TRADE_RETCODE_ONLY_REAL | The Operation is Allowed Only for Real Accounts | Ensure the operation is being conducted on a real account, not a demo account. |
10033 | TRADE_RETCODE_LIMIT_ORDERS | The Limit on the Number of Pending Orders has Been Reached | Reduce the number of pending orders or contact the broker for adjustments. |
10034 | TRADE_RETCODE_LIMIT_VOLUME | The Limit on the Volume of Orders and Positions for This Symbol has Been Reached | Reduce the trade volume or contact the broker for adjustments. |
10035 | TRADE_RETCODE_INVALID_ORDER | Invalid or Prohibited Order Type | Check the allowed order types for the broker and retry with a valid type. |
10036 | TRADE_RETCODE_POSITION_CLOSED | Position with Specified POSITION_IDENTIFIER is Already Closed | No action needed. The position has already been closed. |
10038 | TRADE_RETCODE_INVALID_CLOSE_VOLUME | Closed Volume Exceeds Current Position Volume | Ensure the volume to close does not exceed the current position size. |
10039 | TRADE_RETCODE_CLOSE_ORDER_EXIST | No Connection to the Trade Server | Check the connection and reattempt once the server is reachable. |
10040 | TRADE_RETCODE_LIMIT_POSITIONS | The Request was Rejected Because the Symbol is Set to the Rule “You Can Only Close Existing Positions.” | Close existing positions before attempting new ones. |
10041 | TRADE_RETCODE_REJECT_CANCEL | The Request was Rejected Because the Symbol is Set to the Rule “You Can Only Close Existing Positions.” | Adjust the trade to comply with the “close-only” rule. |
10042 | TRADE_RETCODE_LONG_ONLY | The Request was Rejected Because the Rule “Only Long Positions Allowed” is Set on the Symbol | Only long positions are allowed for this symbol; avoid submitting short trades. |
10043 | TRADE_RETCODE_SHORT_ONLY | The Request was Rejected Because the Rule “Only Short Positions Allowed” is Set on the Symbol | Only short positions are allowed for this symbol; avoid submitting long trades. |
10044 | TRADE_RETCODE_CLOSE_ONLY | The Request was Rejected Because the Symbol is Set to the Rule “You Can Only Close Existing Positions” | Comply with the “close-only” rule by closing positions instead of opening new ones. |
Other Errors
Error Code | Error Number | Description | Solution Method |
---|---|---|---|
ERR_SUCCESS | 0 | Operation Completed Successfully | No action required. |
ERR_INTERNAL_ERROR | 4001 | Unexpected Internal Error | Check for system or program conflicts and restart the terminal. |
ERR_WRONG_INTERNAL_PARAMETER | 4002 | The Structure Contains Invalid Objects Like Strings, Dynamic Arrays, or Unsupported Structures | Review the structure of the objects and ensure they are properly defined. |
ERR_INVALID_PARAMETER | 4003 | Wrong Parameter When Calling a System Function | Verify the function’s parameters and ensure they match the required format. |
ERR_NOT_ENOUGH_MEMORY | 4004 | Not Enough Memory to Execute a System Function | Free up system memory or optimize the program to use less memory. |
ERR_STRUCT_WITHOBJECTS_ORCLASS | 4005 | Not Enough Memory to Reallocate the String | Check for memory leaks and optimize the program’s memory usage. |
ERR_INVALID_ARRAY | 4006 | An Array of the Wrong Type, Size, or a Broken Dynamic Array Object | Ensure the array is correctly defined and initialized before use. |
ERR_ARRAY_RESIZE_ERROR | 4007 | The Requested Array Size Exceeds 2 Gigabytes | Reduce the array size or manage memory allocation more efficiently. |
ERR_STRING_RESIZE_ERROR | 4008 | The Requested History was Not Found | Ensure the requested history is available or adjust the request parameters. |
ERR_NOTINITIALIZED_STRING | 4009 | Uninitialized String | Initialize the string before attempting to use it in operations. |
ERR_INVALID_DATETIME | 4010 | Wrong Date and/or Time Value | Verify the date and time format in the request and retry. |
ERR_ARRAY_BAD_SIZE | 4011 | Mismatched Dynamic and Static Resources | Ensure the array sizes are compatible and correctly initialized. |
ERR_INVALID_POINTER | 4012 | Wrong Pointer | Check the pointer value and ensure it’s valid before use. |
ERR_INVALID_POINTER_TYPE | 4013 | Wrong Pointer Type | Ensure the pointer is of the correct type and properly cast. |
ERR_FUNCTION_NOT_ALLOWED | 4014 | System Function Not Allowed to be Called | Review system restrictions and confirm the function can be executed. |
ERR_RESOURCE_NAME_DUPLICATED | 4015 | Duplicate Resource Name | Use unique resource names to avoid conflicts. |
ERR_RESOURCE_NOT_FOUND | 4016 | No Resource Found with the Specified Name | Ensure the resource exists in the correct directory or file. |
ERR_RESOURCE_UNSUPPOTED_TYPE | 4017 | Unsupported Resource Type or Size Exceeds 16 MB | Use supported resource types and ensure the size is under the limit. |
ERR_RESOURCE_NAME_IS_TOO_LONG | 4018 | Resource Name Exceeds 63 Characters | Shorten the resource name to meet the character limit. |
ERR_MATH_OVERFLOW | 4019 | Overflow Occurred While Evaluating a Math Function | Check the function inputs and use smaller values to prevent overflow. |
ERR_CHART_WRONG_ID | 4101 | Wrong Chart ID | Verify the chart ID and ensure it’s correct before using it. |
ERR_CHART_NO_REPLY | 4102 | Chart Not Responding | Check for system or connection issues and restart the terminal if necessary. |
ERR_CHART_NOT_FOUND | 4103 | Chart Not Found | Ensure the chart is open and accessible before attempting operations. |
ERR_CHART_NO_EXPERT | 4104 | No Expert is Available to Process the Event on the Chart | Attach the necessary Expert Advisor (EA) to the chart to handle events. |
ERR_CHART_CANNOT_OPEN | 4105 | Chart Opening Error | Check for system errors and retry opening the chart. |
ERR_CHART_CANNOT_CHANGE | 4106 | Error Changing Symbol or Period on the Chart | Ensure the chart is accessible and that the requested symbol or period is valid. |
ERR_CHART_WRONG_PARAMETER | 4107 | Wrong Parameter Value for the Chart Function | Verify the parameters being passed to the chart function and retry. |
ERR_CHART_CANNOT_CREATE_TIMER | 4108 | Error Creating Chart Timer | Check the system settings and ensure the terminal allows timer creation. |
ERR_CHART_WRONG_PROPERTY | 4109 | Wrong Chart Property ID | Use the correct property ID for chart operations. |
ERR_CHART_SCREENSHOT_FAILED | 4110 | Error Taking a Screenshot | Ensure the terminal has sufficient permissions and storage space to save the screenshot. |
ERR_CHART_NAVIGATE_FAILED | 4111 | Chart Navigation Error | Ensure the chart is loaded correctly and that navigation commands are valid. |
ERR_CHART_TEMPLATE_FAILED | 4112 | Error Applying Template | Ensure the template exists and is compatible with the chart. |
ERR_CHART_WINDOW_NOT_FOUND | 4113 | The Subwindow Containing the Specified Indicator was Not Found | Check if the indicator is applied to the correct window. |
ERR_CHART_INDICATOR_CANNOT_ADD | 4114 | Error Adding an Indicator to a Chart | Ensure the indicator is valid and supported by the chart. |
ERR_CHART_INDICATOR_CANNOT_DEL | 4115 | Error Deleting an Indicator from a Chart | Ensure the indicator exists on the chart before attempting to delete it. |
ERR_CHART_INDICATOR_NOT_FOUND | 4116 | The Indicator was Not Found on the Specified Chart | Verify the chart and indicator parameters and retry. |
ERR_OBJECT_ERROR | 4201 | The Terminal Settings Limit the Number of Requested Bars | Increase the number of bars allowed in the terminal settings. |
ERR_OBJECT_NOT_FOUND | 4202 | Graphic Object Not Found | Ensure the graphic object exists and is correctly defined. |
ERR_OBJECT_WRONG_PROPERTY | 4203 | Wrong Graphic Object Property Identifier | Use the correct property identifier for graphic object operations. |
ERR_OBJECT_GETDATE_FAILED | 4204 | Access to History Failed | Check the history access permissions and retry the request. |
ERR_OBJECT_GETVALUE_FAILED | 4205 | Unable to Get Value Corresponding to Date | Verify the date range and ensure the history data is available. |
ERR_MARKET_UNKNOWN_SYMBOL | 4301 | Unknown Symbol | Ensure the symbol exists in the Market Watch and is spelled correctly. |
ERR_MARKET_NOT_SELECTED | 4302 | Symbol Not Selected in Market Watch | Select the symbol in Market Watch and retry the operation. |
ERR_MARKET_WRONG_PROPERTY | 4303 | Wrong Symbol Property Identifier | Verify the property identifier and retry the operation. |
ERR_MARKET_LASTTIME_UNKNOWN | 4304 | The Time of the Last Tick is Unknown (There Were No Ticks) | Wait for a tick to arrive and retry the request. |
ERR_MARKET_SELECT_ERROR | 4305 | Error Adding or Removing Symbol in Market Watch | Check for system errors and retry adding or removing the symbol. |
ERR_HISTORY_NOT_FOUND | 4401 | Many Errors Occurred When Loading History | Check for corrupted history data and reload the history if necessary. |
ERR_HISTORY_WRONG_PROPERTY | 4402 | Incorrect History Property Identifier | Use the correct property identifier for history operations. |
ERR_HISTORY_TIMEOUT | 4403 | Timeout Exceeded When Requesting History | Increase the timeout limit or retry during periods of lower system load. |
ERR_GLOBALVARIABLE_NOT_FOUND | 4501 | Client Terminal Global Variable Not Found | Ensure the global variable exists before attempting to use it. |
ERR_GLOBALVARIABLE_EXISTS | 4502 | Global Variable Already Exists | Use a unique name for global variables to avoid conflicts. |
ERR_GLOBALVARIABLE_NOT_MODIFIED | 4503 | No Modifications Were Made to the Global Variable | Ensure the global variable is modified before attempting to update it. |
ERR_GLOBALVARIABLE_CANNOTREAD | 4504 | Failed to Read Global Variable Value | Check file permissions and ensure the global variable is accessible. |
ERR_GLOBALVARIABLE_CANNOTWRITE | 4505 | Failed to Write Global Variable Value | Ensure there is sufficient permission and storage space to write the file. |
ERR_MAIL_SEND_FAILED | 4510 | Failed to Send an Email | Check email server settings and ensure the email address is correct. |
ERR_PLAY_SOUND_FAILED | 4511 | Failed to Play Sound | Ensure the sound file exists and the system can access it. |
ERR_FTP_SEND_FAILED | 4514 | No FTP Server is Specified | Ensure the FTP server details are entered correctly and retry. |
ERR_NOTIFICATION_SEND_FAILED | 4515 | Failed to Send Notification | Verify the notification settings and ensure they are correctly configured. |
ERR_BUFFERS_NO_MEMORY | 4601 | Not Enough Memory to Allocate Indicator Buffers | Free up memory or optimize buffer usage in the program. |
ERR_ACCOUNT_WRONG_PROPERTY | 4701 | Wrong Account Property ID | Ensure the correct account property ID is being used. |
ERR_TRADE_DISABLED | 4752 | Trading for an Expert is Prohibited | Enable trading permissions for the Expert Advisor in the terminal. |
ERR_TRADE_POSITION_NOT_FOUND | 4753 | Position Not Found | Verify the position details and ensure it exists before attempting operations. |
ERR_TRADE_ORDER_NOT_FOUND | 4754 | Order Not Found | Verify the order ID and ensure it exists before attempting operations. |
MARKET MQL5 Errors
Questions?
If you have any questions, please ask them. We ensure transparency and do not sell products without providing full information.
Each of our products can be reviewed before purchase.
We appreciate your interest and support for our products and strive to maintain high-quality standards.
Thank you for being with us!
Do you have a question?
This post is also available in: English Українська Portuguese Español Deutsch Chinese Русский Français Italiano Türkçe 日本語 한국어
Leave a Reply