MQL4 - automated forex trading   /  

Documentation

ODL Securities

MQL4 Reference  Standard constants  Error codes

 

The GetLastError() function return codes. Error code constants defined at stderror.mqh file. To print text messages use ErrorDescription() function defined at stdlib.mqh file.

#include <stderror.mqh>
#include <stdlib.mqh>
void SendMyMessage(string text)
  {
   int check;
   SendMail("some subject", text);
   check=GetLastError();
   if(check!=ERR_NO_ERROR) Print("Cannot send message, error: ",ErrorDescription(check));
  }

Error codes returned from trade server.

ConstantValueDescription
ERR_NO_ERROR0No error returned.
ERR_NO_RESULT1No error returned, but the result is unknown.
ERR_COMMON_ERROR2Common error.
ERR_INVALID_TRADE_PARAMETERS3Invalid trade parameters.
ERR_SERVER_BUSY4Trade server is busy.
ERR_OLD_VERSION5Old version of the client terminal.
ERR_NO_CONNECTION6No connection with trade server.
ERR_NOT_ENOUGH_RIGHTS7Not enough rights.
ERR_TOO_FREQUENT_REQUESTS8Too frequent requests.
ERR_MALFUNCTIONAL_TRADE9Malfunctional trade operation.
ERR_ACCOUNT_DISABLED64Account disabled.
ERR_INVALID_ACCOUNT65Invalid account.
ERR_TRADE_TIMEOUT128Trade timeout.
ERR_INVALID_PRICE129Invalid price.
ERR_INVALID_STOPS130Invalid stops.
ERR_INVALID_TRADE_VOLUME131Invalid trade volume.
ERR_MARKET_CLOSED132Market is closed.
ERR_TRADE_DISABLED133Trade is disabled.
ERR_NOT_ENOUGH_MONEY134Not enough money.
ERR_PRICE_CHANGED135Price changed.
ERR_OFF_QUOTES136Off quotes.
ERR_BROKER_BUSY137Broker is busy.
ERR_REQUOTE138Requote.
ERR_ORDER_LOCKED139Order is locked.
ERR_LONG_POSITIONS_ONLY_ALLOWED140Long positions only allowed.
ERR_TOO_MANY_REQUESTS141Too many requests.
ERR_TRADE_MODIFY_DENIED145Modification denied because order too close to market.
ERR_TRADE_CONTEXT_BUSY146Trade context is busy.
ERR_TRADE_EXPIRATION_DENIED147Expirations are denied by broker.
ERR_TRADE_TOO_MANY_ORDERS148The amount of open and pending orders has reached the limit set by the broker.

MQL4 run time error codes

ConstantValueDescription
ERR_NO_MQLERROR4000No error.
ERR_WRONG_FUNCTION_POINTER4001Wrong function pointer.
ERR_ARRAY_INDEX_OUT_OF_RANGE4002Array index is out of range.
ERR_NO_MEMORY_FOR_CALL_STACK4003No memory for function call stack.
ERR_RECURSIVE_STACK_OVERFLOW4004Recursive stack overflow.
ERR_NOT_ENOUGH_STACK_FOR_PARAM4005Not enough stack for parameter.
ERR_NO_MEMORY_FOR_PARAM_STRING4006No memory for parameter string.
ERR_NO_MEMORY_FOR_TEMP_STRING4007No memory for temp string.
ERR_NOT_INITIALIZED_STRING4008Not initialized string.
ERR_NOT_INITIALIZED_ARRAYSTRING4009Not initialized string in array.
ERR_NO_MEMORY_FOR_ARRAYSTRING4010No memory for array string.
ERR_TOO_LONG_STRING4011Too long string.
ERR_REMAINDER_FROM_ZERO_DIVIDE4012Remainder from zero divide.
ERR_ZERO_DIVIDE4013Zero divide.
ERR_UNKNOWN_COMMAND4014Unknown command.
ERR_WRONG_JUMP4015Wrong jump (never generated error).
ERR_NOT_INITIALIZED_ARRAY4016Not initialized array.
ERR_DLL_CALLS_NOT_ALLOWED4017DLL calls are not allowed.
ERR_CANNOT_LOAD_LIBRARY4018Cannot load library.
ERR_CANNOT_CALL_FUNCTION4019Cannot call function.
ERR_EXTERNAL_CALLS_NOT_ALLOWED4020Expert function calls are not allowed.
ERR_NO_MEMORY_FOR_RETURNED_STR4021Not enough memory for temp string returned from function.
ERR_SYSTEM_BUSY4022System is busy (never generated error).
ERR_INVALID_FUNCTION_PARAMSCNT4050Invalid function parameters count.
ERR_INVALID_FUNCTION_PARAMVALUE4051Invalid function parameter value.
ERR_STRING_FUNCTION_INTERNAL4052String function internal error.
ERR_SOME_ARRAY_ERROR4053Some array error.
ERR_INCORRECT_SERIESARRAY_USING4054Incorrect series array using.
ERR_CUSTOM_INDICATOR_ERROR4055Custom indicator error.
ERR_INCOMPATIBLE_ARRAYS4056Arrays are incompatible.
ERR_GLOBAL_VARIABLES_PROCESSING4057Global variables processing error.
ERR_GLOBAL_VARIABLE_NOT_FOUND4058Global variable not found.
ERR_FUNC_NOT_ALLOWED_IN_TESTING4059Function is not allowed in testing mode.
ERR_FUNCTION_NOT_CONFIRMED4060Function is not confirmed.
ERR_SEND_MAIL_ERROR4061Send mail error.
ERR_STRING_PARAMETER_EXPECTED4062String parameter expected.
ERR_INTEGER_PARAMETER_EXPECTED4063Integer parameter expected.
ERR_DOUBLE_PARAMETER_EXPECTED4064Double parameter expected.
ERR_ARRAY_AS_PARAMETER_EXPECTED4065Array as parameter expected.
ERR_HISTORY_WILL_UPDATED4066Requested history data in updating state.
ERR_TRADE_ERROR4067Some error in trading function.
ERR_END_OF_FILE4099End of file.
ERR_SOME_FILE_ERROR4100Some file error.
ERR_WRONG_FILE_NAME4101Wrong file name.
ERR_TOO_MANY_OPENED_FILES4102Too many opened files.
ERR_CANNOT_OPEN_FILE4103Cannot open file.
ERR_INCOMPATIBLE_FILEACCESS4104Incompatible access to a file.
ERR_NO_ORDER_SELECTED4105No order selected.
ERR_UNKNOWN_SYMBOL4106Unknown symbol.
ERR_INVALID_PRICE_PARAM4107Invalid price.
ERR_INVALID_TICKET4108Invalid ticket.
ERR_TRADE_NOT_ALLOWED4109Trade is not allowed. Enable checkbox "Allow live trading" in the expert properties.
ERR_LONGS_NOT_ALLOWED4110Longs are not allowed. Check the expert properties.
ERR_SHORTS_NOT_ALLOWED4111Shorts are not allowed. Check the expert properties.
ERR_OBJECT_ALREADY_EXISTS4200Object exists already.
ERR_UNKNOWN_OBJECT_PROPERTY4201Unknown object property.
ERR_OBJECT_DOES_NOT_EXIST4202Object does not exist.
ERR_UNKNOWN_OBJECT_TYPE4203Unknown object type.
ERR_NO_OBJECT_NAME4204No object name.
ERR_OBJECT_COORDINATES_ERROR4205Object coordinates error.
ERR_NO_SPECIFIED_SUBWINDOW4206No specified subwindow.
ERR_SOME_OBJECT_ERROR4207Some error in object function.