Задайте точный вопрос, пожалуйста.
Что Вы делали, чего хотели получить в итоге, и что получилось. Если необходимо, то приложите кусок кода.
К сожалению, на общие недетализированные вопросы можно получить столь же отвлеченные ответы.
Что Вы делали, чего хотели получить в итоге, и что получилось. Если необходимо, то приложите кусок кода.
К сожалению, на общие недетализированные вопросы можно получить столь же отвлеченные ответы.
Задайте точный вопрос, пожалуйста.
Что Вы делали, чего хотели получить в итоге, и что получилось. Если необходимо, то приложите кусок кода.
К сожалению, на общие недетализированные вопросы можно получить столь же отвлеченные ответы.
Что Вы делали, чего хотели получить в итоге, и что получилось. Если необходимо, то приложите кусок кода.
К сожалению, на общие недетализированные вопросы можно получить столь же отвлеченные ответы.
кусок кода выглядит приблизительно так...
NOrd=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",16384,0,Green);
if(NOrd>0)
{
//если ордер установлен
}
else
{
Print("Ордер не установлен с ошибкой = "+DoubleToStr(GetLastError(),0));
NOrd=0;
}
LOG выглядит так:
16:32:50 MyExpert GOLD,H1: Ордер не установлен с ошибкой = 130
Кстати, попутно вопрос - ГДЕ НАЙТИ СПИСОК КОДОВ И ПОЯСНЕНИЙ К ВОЗВРАЩАЕМЫМ ОШИБКАМ MT4?
Пример текстового описания ошибок есть в библиотеке stdlib.mqh (stdlib.mq4):
Использовать очень просто:
Перечень ошибок можно получить, начав на ссылку Error Codes page.
Также достаточно удобно пользоваться встроенным поиском по хелпу:
Использовать очень просто:
#include <stdlib.mqh> ...... int error=GetLastError(); Print("Error = ",ErrorDescription(error));
И конечно же, описания всех ошибок есть во встроенном хелпе MetaEditor:
int GetLastError( )
Returns last occurred error after an operation and sets internal last error value to zero. Error codes listed at Error Codes page.
Returns last occurred error after an operation and sets internal last error value to zero. Error codes listed at Error Codes page.
Перечень ошибок можно получить, начав на ссылку Error Codes page.
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.
Error codes returned from trade server.
Constant Value Description
ERR_NO_ERROR 0 No error returned.
ERR_NO_RESULT 1 No error returned, but result is unknown.
ERR_COMMON_ERROR 2 Common error.
ERR_INVALID_TRADE_PARAMETERS 3 Invalid trade parameters.
ERR_SERVER_BUSY 4 Trade server is busy.
ERR_OLD_VERSION 5 Old version of the client terminal.
ERR_NO_CONNECTION 6 No connection with trade server.
ERR_NOT_ENOUGH_RIGHTS 7 Not enough rights.
ERR_TOO_FREQUENT_REQUESTS 8 Too frequent requests.
ERR_MALFUNCTIONAL_TRADE 9 Malfunctional trade operation.
ERR_ACCOUNT_DISABLED 64 Account disabled.
ERR_INVALID_ACCOUNT 65 Invalid account.
ERR_TRADE_TIMEOUT 128 Trade timeout.
ERR_INVALID_PRICE 129 Invalid price.
ERR_INVALID_STOPS 130 Invalid stops.
ERR_INVALID_TRADE_VOLUME 131 Invalid trade volume.
ERR_MARKET_CLOSED 132 Market is closed.
ERR_TRADE_DISABLED 133 Trade is disabled.
ERR_NOT_ENOUGH_MONEY 134 Not enough money.
ERR_PRICE_CHANGED 135 Price changed.
ERR_OFF_QUOTES 136 Off quotes.
ERR_BROKER_BUSY 137 Broker is busy.
ERR_REQUOTE 138 Requote.
ERR_ORDER_LOCKED 139 Order is locked.
ERR_LONG_POSITIONS_ONLY_ALLOWED 140 Long positions only allowed.
ERR_TOO_MANY_REQUESTS 141 Too many requests.
MQL4 run time error codes
Constant Value Description
ERR_NO_MQLERROR 4000 No error.
ERR_WRONG_FUNCTION_POINTER 4001 Wrong function pointer.
ERR_ARRAY_INDEX_OUT_OF_RANGE 4002 Array index is out of range.
ERR_NO_MEMORY_FOR_FUNCTION_CALL_STACK 4003 No memory for function call stack.
ERR_RECURSIVE_STACK_OVERFLOW 4004 Recursive stack overflow.
ERR_NOT_ENOUGH_STACK_FOR_PARAMETER 4005 Not enough stack for parameter.
ERR_NO_MEMORY_FOR_PARAMETER_STRING 4006 No memory for parameter string.
ERR_NO_MEMORY_FOR_TEMP_STRING 4007 No memory for temp string.
ERR_NOT_INITIALIZED_STRING 4008 Not initialized string.
ERR_NOT_INITIALIZED_ARRAYSTRING 4009 Not initialized string in array.
ERR_NO_MEMORY_FOR_ARRAYSTRING 4010 No memory for array's string.
ERR_TOO_LONG_STRING 4011 Too long string.
ERR_REMAINDER_FROM_ZERO_DIVIDE 4012 Remainder from zero divide.
ERR_ZERO_DIVIDE 4013 Zero divide.
ERR_UNKNOWN_COMMAND 4014 Unknown command.
ERR_WRONG_JUMP 4015 Wrong jump (never generated error).
ERR_NOT_INITIALIZED_ARRAY 4016 Not initialized array.
ERR_DLL_CALLS_NOT_ALLOWED 4017 DLL calls are not allowed.
ERR_CANNOT_LOAD_LIBRARY 4018 Cannot load library.
ERR_CANNOT_CALL_FUNCTION 4019 Cannot call function.
ERR_EXTERNAL_EXPERT_CALLS_NOT_ALLOWED 4020 Expert function calls are not allowed.
ERR_NOT_ENOUGH_MEMORY_FOR_RETURNED_STRING 4021 Not enough memory for temp string returned from function.
ERR_SYSTEM_BUSY 4022 System is busy (never generated error).
ERR_INVALID_FUNCTION_PARAMETERS_COUNT 4050 Invalid function parameters count.
ERR_INVALID_FUNCTION_PARAMETER_VALUE 4051 Invalid function parameter value.
ERR_STRING_FUNCTION_INTERNAL_ERROR 4052 String function internal error.
ERR_SOME_ARRAY_ERROR 4053 Some array error.
ERR_INCORRECT_SERIES_ARRAY_USING 4054 Incorrect series array using.
ERR_CUSTOM_INDICATOR_ERROR 4055 Custom indicator error.
ERR_INCOMPATIBLE_ARRAYS 4056 Arrays are incompatible.
ERR_GLOBAL_VARIABLES_PROCESSING_ERROR 4057 Global variables processing error.
ERR_GLOBAL_VARIABLE_NOT_FOUND 4058 Global variable not found.
ERR_FUNCTION_NOT_ALLOWED_IN_TESTING_MODE 4059 Function is not allowed in testing mode.
ERR_FUNCTION_NOT_CONFIRMED 4060 Function is not confirmed.
ERR_SEND_MAIL_ERROR 4061 Send mail error.
ERR_STRING_PARAMETER_EXPECTED 4062 String parameter expected.
ERR_INTEGER_PARAMETER_EXPECTED 4063 Integer parameter expected.
ERR_DOUBLE_PARAMETER_EXPECTED 4064 Double parameter expected.
ERR_ARRAY_AS_PARAMETER_EXPECTED 4065 Array as parameter expected.
ERR_HISTORY_WILL_UPDATED 4066 Requested history data in update state.
ERR_END_OF_FILE 4099 End of file.
ERR_SOME_FILE_ERROR 4100 Some file error.
ERR_WRONG_FILE_NAME 4101 Wrong file name.
ERR_TOO_MANY_OPENED_FILES 4102 Too many opened files.
ERR_CANNOT_OPEN_FILE 4103 Cannot open file.
ERR_INCOMPATIBLE_ACCESS_TO_FILE 4104 Incompatible access to a file.
ERR_NO_ORDER_SELECTED 4105 No order selected.
ERR_UNKNOWN_SYMBOL 4106 Unknown symbol.
ERR_INVALID_PRICE 4107 Invalid price.
ERR_INVALID_TICKET 4108 Invalid ticket.
ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed.
ERR_LONGS__NOT_ALLOWED 4110 Longs are not allowed.
ERR_SHORTS_NOT_ALLOWED 4111 Shorts are not allowed.
ERR_OBJECT_ALREADY_EXISTS 4200 Object is already exist.
ERR_UNKNOWN_OBJECT_PROPERTY 4201 Unknown object property.
ERR_OBJECT_DOES_NOT_EXIST 4202 Object is not exist.
ERR_UNKNOWN_OBJECT_TYPE 4203 Unknown object type.
ERR_NO_OBJECT_NAME 4204 No object name.
ERR_OBJECT_COORDINATES_ERROR 4205 Object coordinates error.
ERR_NO_SPECIFIED_SUBWINDOW 4206 No specified subwindow.
#include <stdlib.mqh>
void SendMyMessage(string text)
{
int check;
SendMail("some subject", text);
check=GetLastError();
if(check!=ERR_NO_MQLERROR) Print(Can't send message, error: ",ErrorDescription(check));
}
void SendMyMessage(string text)
{
int check;
SendMail("some subject", text);
check=GetLastError();
if(check!=ERR_NO_MQLERROR) Print(Can't send message, error: ",ErrorDescription(check));
}
Error codes returned from trade server.
Constant Value Description
ERR_NO_ERROR 0 No error returned.
ERR_NO_RESULT 1 No error returned, but result is unknown.
ERR_COMMON_ERROR 2 Common error.
ERR_INVALID_TRADE_PARAMETERS 3 Invalid trade parameters.
ERR_SERVER_BUSY 4 Trade server is busy.
ERR_OLD_VERSION 5 Old version of the client terminal.
ERR_NO_CONNECTION 6 No connection with trade server.
ERR_NOT_ENOUGH_RIGHTS 7 Not enough rights.
ERR_TOO_FREQUENT_REQUESTS 8 Too frequent requests.
ERR_MALFUNCTIONAL_TRADE 9 Malfunctional trade operation.
ERR_ACCOUNT_DISABLED 64 Account disabled.
ERR_INVALID_ACCOUNT 65 Invalid account.
ERR_TRADE_TIMEOUT 128 Trade timeout.
ERR_INVALID_PRICE 129 Invalid price.
ERR_INVALID_STOPS 130 Invalid stops.
ERR_INVALID_TRADE_VOLUME 131 Invalid trade volume.
ERR_MARKET_CLOSED 132 Market is closed.
ERR_TRADE_DISABLED 133 Trade is disabled.
ERR_NOT_ENOUGH_MONEY 134 Not enough money.
ERR_PRICE_CHANGED 135 Price changed.
ERR_OFF_QUOTES 136 Off quotes.
ERR_BROKER_BUSY 137 Broker is busy.
ERR_REQUOTE 138 Requote.
ERR_ORDER_LOCKED 139 Order is locked.
ERR_LONG_POSITIONS_ONLY_ALLOWED 140 Long positions only allowed.
ERR_TOO_MANY_REQUESTS 141 Too many requests.
MQL4 run time error codes
Constant Value Description
ERR_NO_MQLERROR 4000 No error.
ERR_WRONG_FUNCTION_POINTER 4001 Wrong function pointer.
ERR_ARRAY_INDEX_OUT_OF_RANGE 4002 Array index is out of range.
ERR_NO_MEMORY_FOR_FUNCTION_CALL_STACK 4003 No memory for function call stack.
ERR_RECURSIVE_STACK_OVERFLOW 4004 Recursive stack overflow.
ERR_NOT_ENOUGH_STACK_FOR_PARAMETER 4005 Not enough stack for parameter.
ERR_NO_MEMORY_FOR_PARAMETER_STRING 4006 No memory for parameter string.
ERR_NO_MEMORY_FOR_TEMP_STRING 4007 No memory for temp string.
ERR_NOT_INITIALIZED_STRING 4008 Not initialized string.
ERR_NOT_INITIALIZED_ARRAYSTRING 4009 Not initialized string in array.
ERR_NO_MEMORY_FOR_ARRAYSTRING 4010 No memory for array's string.
ERR_TOO_LONG_STRING 4011 Too long string.
ERR_REMAINDER_FROM_ZERO_DIVIDE 4012 Remainder from zero divide.
ERR_ZERO_DIVIDE 4013 Zero divide.
ERR_UNKNOWN_COMMAND 4014 Unknown command.
ERR_WRONG_JUMP 4015 Wrong jump (never generated error).
ERR_NOT_INITIALIZED_ARRAY 4016 Not initialized array.
ERR_DLL_CALLS_NOT_ALLOWED 4017 DLL calls are not allowed.
ERR_CANNOT_LOAD_LIBRARY 4018 Cannot load library.
ERR_CANNOT_CALL_FUNCTION 4019 Cannot call function.
ERR_EXTERNAL_EXPERT_CALLS_NOT_ALLOWED 4020 Expert function calls are not allowed.
ERR_NOT_ENOUGH_MEMORY_FOR_RETURNED_STRING 4021 Not enough memory for temp string returned from function.
ERR_SYSTEM_BUSY 4022 System is busy (never generated error).
ERR_INVALID_FUNCTION_PARAMETERS_COUNT 4050 Invalid function parameters count.
ERR_INVALID_FUNCTION_PARAMETER_VALUE 4051 Invalid function parameter value.
ERR_STRING_FUNCTION_INTERNAL_ERROR 4052 String function internal error.
ERR_SOME_ARRAY_ERROR 4053 Some array error.
ERR_INCORRECT_SERIES_ARRAY_USING 4054 Incorrect series array using.
ERR_CUSTOM_INDICATOR_ERROR 4055 Custom indicator error.
ERR_INCOMPATIBLE_ARRAYS 4056 Arrays are incompatible.
ERR_GLOBAL_VARIABLES_PROCESSING_ERROR 4057 Global variables processing error.
ERR_GLOBAL_VARIABLE_NOT_FOUND 4058 Global variable not found.
ERR_FUNCTION_NOT_ALLOWED_IN_TESTING_MODE 4059 Function is not allowed in testing mode.
ERR_FUNCTION_NOT_CONFIRMED 4060 Function is not confirmed.
ERR_SEND_MAIL_ERROR 4061 Send mail error.
ERR_STRING_PARAMETER_EXPECTED 4062 String parameter expected.
ERR_INTEGER_PARAMETER_EXPECTED 4063 Integer parameter expected.
ERR_DOUBLE_PARAMETER_EXPECTED 4064 Double parameter expected.
ERR_ARRAY_AS_PARAMETER_EXPECTED 4065 Array as parameter expected.
ERR_HISTORY_WILL_UPDATED 4066 Requested history data in update state.
ERR_END_OF_FILE 4099 End of file.
ERR_SOME_FILE_ERROR 4100 Some file error.
ERR_WRONG_FILE_NAME 4101 Wrong file name.
ERR_TOO_MANY_OPENED_FILES 4102 Too many opened files.
ERR_CANNOT_OPEN_FILE 4103 Cannot open file.
ERR_INCOMPATIBLE_ACCESS_TO_FILE 4104 Incompatible access to a file.
ERR_NO_ORDER_SELECTED 4105 No order selected.
ERR_UNKNOWN_SYMBOL 4106 Unknown symbol.
ERR_INVALID_PRICE 4107 Invalid price.
ERR_INVALID_TICKET 4108 Invalid ticket.
ERR_TRADE_NOT_ALLOWED 4109 Trade is not allowed.
ERR_LONGS__NOT_ALLOWED 4110 Longs are not allowed.
ERR_SHORTS_NOT_ALLOWED 4111 Shorts are not allowed.
ERR_OBJECT_ALREADY_EXISTS 4200 Object is already exist.
ERR_UNKNOWN_OBJECT_PROPERTY 4201 Unknown object property.
ERR_OBJECT_DOES_NOT_EXIST 4202 Object is not exist.
ERR_UNKNOWN_OBJECT_TYPE 4203 Unknown object type.
ERR_NO_OBJECT_NAME 4204 No object name.
ERR_OBJECT_COORDINATES_ERROR 4205 Object coordinates error.
ERR_NO_SPECIFIED_SUBWINDOW 4206 No specified subwindow.
Также достаточно удобно пользоваться встроенным поиском по хелпу:
спасибо.
почему-то в более ранних версиях MT4 я не обнаружил ErrorDescription и решил что их и не будет...
почему-то в более ранних версиях MT4 я не обнаружил ErrorDescription и решил что их и не будет...
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
есть какие-то особенности?