No error returned, but the result is unknown

To add comments, please log in or register
GrumpyDuckMan
882
GrumpyDuckMan  

Hello everyone,

I have had this problem before and I still do not understand its meaning. The code below causes it sometimes, I still am clueless as why this happening again.

To me the statement is double dutch..

there isn't an error, so how can a result be unknown?

     
   bool TrailingStop=OrderModify(ticket,Price,Stoploss,TakeProfit,0,clrGray);
   if(!TrailingStop)  Operation();
   else Operation();
  }
}
//+------------------------------------------------------------------+
void Operation()
{

 switch (GetLastError()) // Condition validation
   { 
case 0: Comment("\n Order Placed Sussesfully :"); break;
case 1: Comment("\n No error returned, but the result is unknown :");break;
case 2: Comment("\n Common error :");break;
case 3: Comment("\n Invalid trade parameters :"); break;
//case 4:  ERR_SERVER_BUSY Trade server is busy
//case 5:  ERR_OLD_VERSION Old Version of the client terminal
case 6: Comment("\n No connection :");break;
//case 7:  ERR_NOT_ENOUGH_RIGHTS Not enough rights
//case 8:  ERR_TOO_FREQUENT_REQUESTS Too frequent requests
//case 9:  ERR_MALFUNCTIONAL_TRADE Malfunctional trade operation
//case 64:  ERR_ACCOUNT_DISABLED Account disabled
case 65: Comment("\n Invalid Account :");break;
//case 128: ERR_TRADE_TIMEOUT Trade timeout
//case 129: ERR_INVALID_PRICE Invalid price
case 130: Comment("\n Invalid stops :");break;
//case 131: ERR_INVALID_TRADE_VOLUME Invalid trade volume
// Market is closed
case 132: ExpertRemove(); 
// Trade is disabled
case 133: ExpertRemove(); 
case 134: Comment("\n Selected Account doesn't have enough money :", (string)AccountNumber());break;
//case 135: ERR_PRICE_CHANGED Price changed
//case 136: ERR_OFF_QUOTES Off quotes
//case 137: ERR_BROKER_BUSY Broker is busy
//case 138: ERR_REQUOTE Requote
//case 139: ERR_ORDER_LOCKED Order is locked
//case 140: ERR_LONG_POSITIONS_ONLY_ALLOWED Buy orders only allowed
//case 141: ERR_TOO_MANY_REQUESTS Too many requests
//case 145: ERR_TRADE_MODIFY_DENIED Modification denied because order is too close to market
//case 146: ERR_TRADE_CONTEXT_BUSY Trade context is busy
//case 147: ERR_TRADE_EXPIRATION_DENIED Expirations are denied by broker
//case 148: ERR_TRADE_TOO_MANY_ORDERS The amount of open and pending orders has reached the limit set by the broker
//case 149: ERR_TRADE_HEDGE_PROHIBITED An attempt to open an order opposite to the existing one when hedging is disabled
//case 150: ERR_TRADE_PROHIBITED_BY_FIFO An attempt to close an order contravening the FIFO rule
//case 4000: ERR_NO_MQLERROR No error returned
//case 4001: ERR_WRONG_FUNCTION_POINTER Wrong function pointer
//case 4002: ERR_ARRAY_INDEX_OUT_OF_RANGE Array index is out of range
//case 4003: ERR_NO_MEMORY_FOR_CALL_STACK No memory For function call stack
//case 4004: ERR_RECURSIVE_STACK_OVERFLOW Recursive stack overflow
//case 4005: ERR_NOT_ENOUGH_STACK_FOR_PARAM Not enough stack For parameter
//case 4006: ERR_NO_MEMORY_FOR_PARAM_STRING No memory For parameter String
//case 4007: ERR_NO_MEMORY_FOR_TEMP_STRING No memory For temp String
//case 4008: ERR_NOT_INITIALIZED_STRING Not initialized String
//case 4009: ERR_NOT_INITIALIZED_ARRAYSTRING Not initialized String in array
//case 4010: ERR_NO_MEMORY_FOR_ARRAYSTRING No memory For array String
//case 4011: ERR_TOO_LONG_STRING Too long string
//case 4012: ERR_REMAINDER_FROM_ZERO_DIVIDE Remainder from zero divide
//case 4013: ERR_ZERO_DIVIDE Zero divide
//case 4014: ERR_UNKNOWN_COMMAND Unknown command
//case 4015: ERR_WRONG_JUMP Wrong jump (never generated error)
//case 4016: ERR_NOT_INITIALIZED_ARRAY Not initialized array
//case 4017: ERR_DLL_CALLS_NOT_ALLOWED DLL calls are not allowed
//case 4018: ERR_CANNOT_LOAD_LIBRARY Cannot load library
//case 4019: ERR_CANNOT_CALL_FUNCTION Cannot call function
//case 4020: ERR_EXTERNAL_CALLS_NOT_ALLOWED Expert function calls are not allowed
//case 4021: ERR_NO_MEMORY_FOR_RETURNED_STR Not enough memory for temp string returned from function
//case 4022: ERR_SYSTEM_BUSY System is busy (never generated error)
//case 4023: ERR_DLLFUNC_CRITICALERROR DLL-function call critical error
//case 4024: ERR_INTERNAL_ERROR Internal error
//case 4025: ERR_OUT_OF_MEMORY Out of memory
//case 4026: ERR_INVALID_POINTER Invalid pointer
//case 4027: ERR_FORMAT_TOO_MANY_FORMATTERS Too many formatters in the format function
//case 4028: ERR_FORMAT_TOO_MANY_PARAMETERS Parameters count exceeds formatters count
//case 4029: ERR_ARRAY_INVALID Invalid array
//case 4030: ERR_CHART_NOREPLY No reply from chart
//case 4050: ERR_INVALID_FUNCTION_PARAMSCNT Invalid function parameters count
//case 4051: ERR_INVALID_FUNCTION_PARAMVALUE Invalid function parameter value
//case 4052: ERR_STRING_FUNCTION_INTERNAL String function internal error
//case 4053: ERR_SOME_ARRAY_ERROR Some array error
//case 4054: ERR_INCORRECT_SERIESARRAY_USING Incorrect series array using
//case 4055: ERR_CUSTOM_INDICATOR_ERROR Custom indicator error
//case 4056: ERR_INCOMPATIBLE_ARRAYS Arrays are incompatible
//case 4057: ERR_GLOBAL_VARIABLES_PROCESSING Global variables processing error
//case 4058: ERR_GLOBAL_VARIABLE_NOT_FOUND Global variable not found
//case 4059: ERR_FUNC_NOT_ALLOWED_IN_TESTING Function is not allowed in testing mode
//case 4060: ERR_FUNCTION_NOT_CONFIRMED Function is not allowed for call
//case 4061: ERR_SEND_MAIL_ERROR Send mail error
//case 4062: ERR_STRING_PARAMETER_EXPECTED String parameter expected
//case 4063: ERR_INTEGER_PARAMETER_EXPECTED Integer parameter expected
//case 4064: ERR_DOUBLE_PARAMETER_EXPECTED Double parameter expected
//case 4065: ERR_ARRAY_AS_PARAMETER_EXPECTED Array as parameter expected
//case 4066: ERR_HISTORY_WILL_UPDATED Requested history data is in updating state
//case 4067: ERR_TRADE_ERROR Internal trade error
//case 4068: ERR_RESOURCE_NOT_FOUND Resource not found
//case 4069: ERR_RESOURCE_NOT_SUPPORTED Resource not supported
//case 4070: ERR_RESOURCE_DUPLICATED Duplicate resource
//case 4071: ERR_INDICATOR_CANNOT_INIT Custom indicator cannot initialize
//case 4072: ERR_INDICATOR_CANNOT_LOAD Cannot load custom indicator
//case 4073: ERR_NO_HISTORY_DATA No history data
//case 4074: ERR_NO_MEMORY_FOR_HISTORY No memory for history data
//case 4075: ERR_NO_MEMORY_FOR_INDICATOR Not enough memory for indicator calculation
//case 4099: ERR_END_OF_FILE End of file
//case 4100: ERR_SOME_FILE_ERROR Some file error
//case 4101: ERR_WRONG_FILE_NAME Wrong file name
//case 4102: ERR_TOO_MANY_OPENED_FILES Too many opened files
//case 4103: ERR_CANNOT_OPEN_FILE Cannot open file
//case 4104: ERR_INCOMPATIBLE_FILEACCESS Incompatible access to a file
//case 4105: ERR_NO_ORDER_SELECTED No order selected
//case 4106: ERR_UNKNOWN_SYMBOL Unknown symbol
//case 4107: ERR_INVALID_PRICE_PARAM Invalid price
//case 4108: ERR_INVALID_TICKET Invalid ticket
case 4109: Comment("\n check box: ( Allow Live Trading ) must be checked. ");break;
case 4110: Comment("\n Check the EA properties;  Only SHORT's are allowed. ");break;
case 4111: Comment("\n Check the EA properties:  Only LONG's are allowed.  ");break;
//case 4112: ERR_TRADE_EXPERT_DISABLED_BY_SERVER Automated trading by Expert Advisors/Scripts disabled by trade server
//case 4200: ERR_OBJECT_ALREADY_EXISTS Object already exists
//case 4201: ERR_UNKNOWN_OBJECT_PROPERTY Unknown object property
//case 4202: ERR_OBJECT_DOES_NOT_EXIST Object does not exist
//case 4203: ERR_UNKNOWN_OBJECT_TYPE Unknown object type
//case 4204: ERR_NO_OBJECT_NAME No object name
//case 4205: ERR_OBJECT_COORDINATES_ERROR Object coordinates error
//case 4206: ERR_NO_SPECIFIED_SUBWINDOW No specified subwindow
//case 4207: ERR_SOME_OBJECT_ERROR Graphical object error
//case 4210: ERR_CHART_PROP_INVALID Unknown chart property
//case 4211: ERR_CHART_NOT_FOUND Chart not found
//case 4212: ERR_CHARTWINDOW_NOT_FOUND Chart subwindow not found
//case 4213: ERR_CHARTINDICATOR_NOT_FOUND Chart indicator not found
//case 4220: ERR_SYMBOL_SELECT Symbol select error
//case 4250: ERR_NOTIFICATION_ERROR Notification error
//case 4251: ERR_NOTIFICATION_PARAMETER Notification parameter error
//case 4252: ERR_NOTIFICATION_SETTINGS Notifications disabled
//case 4253: ERR_NOTIFICATION_TOO_FREQUENT Notification send too frequent
//case 5001: ERR_FILE_TOO_MANY_OPENED Too many opened files
//case 5002: ERR_FILE_WRONG_FILENAME Wrong file name
//case 5003: ERR_FILE_TOO_LONG_FILENAME Too long file name
//case 5004: ERR_FILE_CANNOT_OPEN Cannot open file
//case 5005: ERR_FILE_BUFFER_ALLOCATION_ERROR Text file buffer allocation error
//case 5006: ERR_FILE_CANNOT_DELETE Cannot delete file
//case 5007: ERR_FILE_INVALID_HANDLE Invalid file handle (file closed or was not opened)
//case 5008: ERR_FILE_WRONG_HANDLE Wrong file handle (handle index is out of handle table)
//case 5009: ERR_FILE_NOT_TOWRITE File must be opened with FILE_WRITE flag
//case 5010: ERR_FILE_NOT_TOREAD File must be opened with FILE_READ flag
//case 5011: ERR_FILE_NOT_BIN File must be opened with FILE_BIN flag
//case 5012: ERR_FILE_NOT_TXT File must be opened with FILE_TXT flag
//case 5013: ERR_FILE_NOT_TXTORCSV File must be opened with FILE_TXT or FILE_CSV flag
//case 5014: ERR_FILE_NOT_CSV File must be opened with FILE_CSV flag
//case 5015: ERR_FILE_READ_ERROR File read error
//case 5016: ERR_FILE_WRITE_ERROR File write error
//case 5017: ERR_FILE_BIN_STRINGSIZE String size must be specified For binary file
//case 5018: ERR_FILE_INCOMPATIBLE Incompatible file (For String arrays-TXT, For others-BIN)
//case 5019: ERR_FILE_IS_DIRECTORY File is directory not file
//case 5020: ERR_FILE_NOT_EXIST File does not exist
//case 5021: ERR_FILE_CANNOT_REWRITE File cannot be rewritten
//case 5022: ERR_FILE_WRONG_DIRECTORYNAME Wrong directory name
//case 5023: ERR_FILE_DIRECTORY_NOT_EXIST Directory does not exist
//case 5024: ERR_FILE_NOT_DIRECTORY Specified file is not directory
//case 5025: ERR_FILE_CANNOT_DELETE_DIRECTORY Cannot Delete directory
//case 5026: ERR_FILE_CANNOT_CLEAN_DIRECTORY Cannot clean directory
//case 5027: ERR_FILE_ARRAYRESIZE_ERROR Array resize error
//case 5028: ERR_FILE_STRINGRESIZE_ERROR String resize error
//case 5029: ERR_FILE_STRUCT_WITH_OBJECTS Structure contains strings or dynamic arrays
//case 5200: ERR_WEBREQUEST_INVALID_ADDRESS Invalid URL
//case 5201: ERR_WEBREQUEST_CONNECT_FAILED Failed to connect to specified URL
//case 5202: ERR_WEBREQUEST_TIMEOUT Timeout exceeded
//case 5203: ERR_WEBREQUEST_REQUEST_FAILED HTTP request failed
default: break; }
}
//4260 ERR_FTP_NOSERVER FTP server is not specified
//4261 ERR_FTP_NOLOGIN FTP login is not specified
//4262 ERR_FTP_CONNECT_FAILED FTP connection failed
//4263 ERR_FTP_CLOSED FTP connection closed
//4264 ERR_FTP_CHANGEDIR FTP path not found on server
//4265 ERR_FTP_FILE_ERROR File not found in the MQL4 Files directory to send on FTP server
//4266 ERR_FTP_ERROR Common error during FTP data transmission








William Roeder
20207
William Roeder  
GrumpyDuckMan: I have had this problem before and I still do not understand its meaning. 

You lost connection after sending the modify. The server may or may not have received the request, and if it did, may or may not have modified the order. You never received a result, so the result is unknown.

Log the problem. Return from OnTick. When the terminal reconnects and calls OnTick again, see if you need to redo the modify or not.

GrumpyDuckMan
882
GrumpyDuckMan  

Hello whroeder1,

Very interesting, I have had some concerns that when my terminal is unattended that the EA may stop or freeze up.  Until now I have assumed that it was some sort of strange coding error.

To add comments, please log in or register