xr86yp295m Forex Leader: 10/10/09

MT4 error messages and descriptions

There are 2 files for which you have access in your MT4 platform which are related to error messages. The 2 files are located here:

1. C:\Program files\Your_MT4_Directory\Experts\Include\stderror.mqh
2. C:\Program files\Your_MT4_Directory\Experts\Librairies\stdlib.mq4

First, you’ve got a list of codes returned from the trade server, followed by MQL4 errors. You can see the number of the error and the code description – see below:

//+------------------------------------------------------------------+
// return error description
//+------------------------------------------------------------------+

//---- codes returned from trade server
case 0:
case 1: error_string="no error";
case 2: error_string="common error";
case 3: error_string="invalid trade parameters";
case 4: error_string="trade server is busy";
case 5: error_string="old version of the client terminal";
case 6: error_string="no connection with trade server";
case 7: error_string="not enough rights";
case 8: error_string="too frequent requests";
case 9: error_string="malfunctional trade operation (never returned error)";
case 64: error_string="account disabled";
case 65: error_string="invalid account";
case 128: error_string="trade timeout";
case 129: error_string="invalid price";
case 130: error_string="invalid stops";
case 131: error_string="invalid trade volume";
case 132: error_string="market is closed";
case 133: error_string="trade is disabled";
case 134: error_string="not enough money";
case 135: error_string="price changed";
case 136: error_string="off quotes";
case 137: error_string="broker is busy (never returned error)";
case 138: error_string="requote";
case 139: error_string="order is locked";
case 140: error_string="long positions only allowed";
case 141: error_string="too many requests";
case 145: error_string="modification denied because order too close to market";
case 146: error_string="trade context is busy";
case 147: error_string="expirations are denied by broker";
case 148: error_string="amount of open and pending orders has reached the limit";


//---- mql4 errors

case 4000: error_string="no error (never generated code)";
case 4001: error_string="wrong function pointer";
case 4002: error_string="array index is out of range";
case 4003: error_string="no memory for function call stack";
case 4004: error_string="recursive stack overflow";
case 4005: error_string="not enough stack for parameter";
case 4006: error_string="no memory for parameter string";
case 4007: error_string="no memory for temp string";
case 4008: error_string="not initialized string";
case 4009: error_string="not initialized string in array";
case 4010: error_string="no memory for array\' string";
case 4011: error_string="too long string";
case 4012: error_string="remainder from zero divide";
case 4013: error_string="zero divide";
case 4014: error_string="unknown command";
case 4015: error_string="wrong jump (never generated error)";
case 4016: error_string="not initialized array";
case 4017: error_string="dll calls are not allowed";
case 4018: error_string="cannot load library";
case 4019: error_string="cannot call function";
case 4020: error_string="expert function calls are not allowed";
case 4021: error_string="not enough memory for temp string returned from function";
case 4022: error_string="system is busy (never generated error)";
case 4050: error_string="invalid function parameters count";
case 4051: error_string="invalid function parameter value";
case 4052: error_string="string function internal error";
case 4053: error_string="some array error";
case 4054: error_string="incorrect series array using";
case 4055: error_string="custom indicator error";
case 4056: error_string="arrays are incompatible";
case 4057: error_string="global variables processing error";
case 4058: error_string="global variable not found";
case 4059: error_string="function is not allowed in testing mode";
case 4060: error_string="function is not confirmed";
case 4061: error_string="send mail error";
case 4062: error_string="string parameter expected";
case 4063: error_string="integer parameter expected";
case 4064: error_string="double parameter expected";
case 4065: error_string="array as parameter expected";
case 4066: error_string="requested history data in update state";
case 4099: error_string="end of file";
case 4100: error_string="some file error";
case 4101: error_string="wrong file name";
case 4102: error_string="too many opened files";
case 4103: error_string="cannot open file";
case 4104: error_string="incompatible access to a file";
case 4105: error_string="no order selected";
case 4106: error_string="unknown symbol";
case 4107: error_string="invalid price parameter for trade function";
case 4108: error_string="invalid ticket";
case 4109: error_string="trade is not allowed in the expert properties";
case 4110: error_string="longs are not allowed in the expert properties";
case 4111: error_string="shorts are not allowed in the expert properties";
case 4200: error_string="object is already exist";
case 4201: error_string="unknown object property";
case 4202: error_string="object is not exist";
case 4203: error_string="unknown object type";
case 4204: error_string="no object name";
case 4205: error_string="object coordinates error";
case 4206: error_string="no specified subwindow";
default: error_string="unknown error";

New version of EA - Error Messages

New version of EA – Error messages

You might remember I wrote a while back about an error message I have been getting from time to time for which (1) I don’t know the cause and (2) can’t find a solution because of (1). So I just live with it. That error is “(0) No Error”. Now what this does is after there is a valid cross and an alert is sent, the open trade order is sent but then this No Error shows up and no trade is taken. You can see in the example below exactly what shows up in your lower Experts folder. This happened last Monday with GBPAUD (you have to read from bottom to top).



As you can see, you’ve got first “Alert: Moving Average Cross Down” followed by the closing of the previous Buy then it says the stdlib was loaded successfully (more on that later) then instead of getting a normal message which would say “Open Sell”, the Error Message appeared “Error Opening Sell order: (0) no error” and no trade was taken. Let me show you what happened to GBPAUD after that:



You can see the closing of the previous Buy (red triangle) and also the crossing of the MAs and also that no Sell order was taken – this would appear as a small red arrow. You can also see that this trade would currently be approx. +700 pips.

Well the problem is now partially solved ! I finally got a very good and friendly programmer, Mladen, to help me out with this. As far as I can understand his explanation, this is kind of a “false” error in the sense that all errors are supposed to have a number + a description (see next post with all the errors listed). This one is due to a programming glitch which results in the correct “error” not being shown which shows up as a (0) error. What the programmer did is fix things so next time the error occurs, it will return the RIGHT number and description and I’ll finally be able to figure out what the problem is – maybe it’s because of a special parameter in the EA or it’s broker related or something else, but at least I’ll know what it is and then be able to figure out a way to correct it, if it’s possible. It might not be – remember sometimes we get the “Trade Context Busy” error for which we can’t do anything because it’s broker related and we just have to accept it as part of our trading life. But maybe it’ll be something else which can be fixed. So I’m totally grateful to Mladen for his help and next week I’ll be watching closely to see what was hiding behind that (0) error. I uploaded the new version of the EA on my transfer site, so feel free to go get it and replace it, if you’ve been getting those error messages (some people do, some don’t, it’s really a mystery case, that one).

Now if you do get the new version, you’ll need to do a few things. First make a back-up copy of your old version and save it somewhere with a new file name, just in case. The new EA has EXACTLY the same filename as the old one to ensure that no problem occurs so you don’t need to worry about anything. Simply copy the new EA in the Experts directory and that should do the trick (shut down and re-launch your MT4 platforms). If you’ve got any open trades, I thought you’d need to manage them manually, of course, because the new EA can’t “remember” what it hasn’t taken. But I just did a test myself, and by golly! The new EA remembers the old trades! Fascinating. But still, I’ll keep a close eye to make sure. I’ll test things out when markets open and confirm here if that’s all you need to do and that things worked out smoothly (or not) so if you’re unsure, wait a bit before downloading the new EA.

My next entry will be dedicated to the various Error Messages which you can get and what they mean.

UPDATE: A FOLLOW-UP TO THIS POST CAN BE FOUND HERE:

http://forexleader-forexleader.blogspot.com/2010/02/error-messages.html