MQL4参考 标准常量,列举和架构 错误和警告代码 运行时间错误

Runtime Errors

The GetLastError() function return last error code, stored in _LastError predefined variable. This value can be reset using the ResetLastError() function. Error code constants defined at stderror.mqh file. To print text messages use ErrorDescription() function defined at stdlib.mqh file.

For convenience, trade errors are additionally listed in the Trade Server Return Codes section.

Runtime errors of mql4-program:

Code

ID

Description

0

ERR_NO_ERROR

No error returned

1

ERR_NO_RESULT

No error returned, but the result is unknown

2

ERR_COMMON_ERROR

Common error

3

ERR_INVALID_TRADE_PARAMETERS

Invalid trade parameters

4

ERR_SERVER_BUSY

Trade server is busy

5

ERR_OLD_VERSION

Old version of the client terminal

6

ERR_NO_CONNECTION

No connection with trade server

7

ERR_NOT_ENOUGH_RIGHTS

Not enough rights

8

ERR_TOO_FREQUENT_REQUESTS

Too frequent requests

9

ERR_MALFUNCTIONAL_TRADE

Malfunctional trade operation

64

ERR_ACCOUNT_DISABLED

Account disabled

65

ERR_INVALID_ACCOUNT

Invalid account

128

ERR_TRADE_TIMEOUT

Trade timeout

129

ERR_INVALID_PRICE

Invalid price

130

ERR_INVALID_STOPS

Invalid stops

131

ERR_INVALID_TRADE_VOLUME

Invalid trade volume

132

ERR_MARKET_CLOSED

Market is closed

133

ERR_TRADE_DISABLED

Trade is disabled

134

ERR_NOT_ENOUGH_MONEY

Not enough money

135

ERR_PRICE_CHANGED

Price changed

136

ERR_OFF_QUOTES

Off quotes

137

ERR_BROKER_BUSY

Broker is busy

138

ERR_REQUOTE

Requote

139

ERR_ORDER_LOCKED

Order is locked

140

ERR_LONG_POSITIONS_ONLY_ALLOWED

Buy orders only allowed

141

ERR_TOO_MANY_REQUESTS

Too many requests

145

ERR_TRADE_MODIFY_DENIED

Modification denied because order is too close to market

146

ERR_TRADE_CONTEXT_BUSY

Trade context is busy

147

ERR_TRADE_EXPIRATION_DENIED

Expirations are denied by broker

148

ERR_TRADE_TOO_MANY_ORDERS

The amount of open and pending orders has reached the limit set by the broker

149

ERR_TRADE_HEDGE_PROHIBITED

An attempt to open an order opposite to the existing one when hedging is disabled

150

ERR_TRADE_PROHIBITED_BY_FIFO

An attempt to close an order contravening the FIFO rule

4000

ERR_NO_MQLERROR

No error returned

4001

ERR_WRONG_FUNCTION_POINTER

Wrong function pointer

4002

ERR_ARRAY_INDEX_OUT_OF_RANGE

Array index is out of range

4003

ERR_NO_MEMORY_FOR_CALL_STACK

No memory for function call stack

4004

ERR_RECURSIVE_STACK_OVERFLOW

Recursive stack overflow

4005

ERR_NOT_ENOUGH_STACK_FOR_PARAM

Not enough stack for parameter

4006

ERR_NO_MEMORY_FOR_PARAM_STRING

No memory for parameter string

4007

ERR_NO_MEMORY_FOR_TEMP_STRING

No memory for temp string

4008

ERR_NOT_INITIALIZED_STRING

Not initialized string

4009

ERR_NOT_INITIALIZED_ARRAYSTRING

Not initialized string in array

4010

ERR_NO_MEMORY_FOR_ARRAYSTRING

No memory for array string

4011

ERR_TOO_LONG_STRING

Too long string

4012

ERR_REMAINDER_FROM_ZERO_DIVIDE

Remainder from zero divide

4013

ERR_ZERO_DIVIDE

Zero divide

4014

ERR_UNKNOWN_COMMAND

Unknown command

4015

ERR_WRONG_JUMP

Wrong jump (never generated error)

4016

ERR_NOT_INITIALIZED_ARRAY

Not initialized array

4017

ERR_DLL_CALLS_NOT_ALLOWED

DLL calls are not allowed

4018

ERR_CANNOT_LOAD_LIBRARY

Cannot load library

4019

ERR_CANNOT_CALL_FUNCTION

Cannot call function

4020

ERR_EXTERNAL_CALLS_NOT_ALLOWED

Expert function calls are not allowed

4021

ERR_NO_MEMORY_FOR_RETURNED_STR

Not enough memory for temp string returned from function

4022

ERR_SYSTEM_BUSY

System is busy (never generated error)

4023

ERR_DLLFUNC_CRITICALERROR

DLL-function call critical error

4024

ERR_INTERNAL_ERROR

Internal error

4025

ERR_OUT_OF_MEMORY

Out of memory

4026

ERR_INVALID_POINTER

Invalid pointer

4027

ERR_FORMAT_TOO_MANY_FORMATTERS

Too many formatters in the format function

4028

ERR_FORMAT_TOO_MANY_PARAMETERS

Parameters count exceeds formatters count

4029

ERR_ARRAY_INVALID

Invalid array

4030

ERR_CHART_NOREPLY

No reply from chart

4050

ERR_INVALID_FUNCTION_PARAMSCNT

Invalid function parameters count

4051

ERR_INVALID_FUNCTION_PARAMVALUE

Invalid function parameter value

4052

ERR_STRING_FUNCTION_INTERNAL

String function internal error

4053

ERR_SOME_ARRAY_ERROR

Some array error

4054

ERR_INCORRECT_SERIESARRAY_USING

Incorrect series array using

4055

ERR_CUSTOM_INDICATOR_ERROR

Custom indicator error

4056

ERR_INCOMPATIBLE_ARRAYS

Arrays are incompatible

4057

ERR_GLOBAL_VARIABLES_PROCESSING

Global variables processing error

4058

ERR_GLOBAL_VARIABLE_NOT_FOUND

Global variable not found

4059

ERR_FUNC_NOT_ALLOWED_IN_TESTING

Function is not allowed in testing mode

4060

ERR_FUNCTION_NOT_CONFIRMED

Function is not allowed for call

4061

ERR_SEND_MAIL_ERROR

Send mail error

4062

ERR_STRING_PARAMETER_EXPECTED

String parameter expected

4063

ERR_INTEGER_PARAMETER_EXPECTED

Integer parameter expected

4064

ERR_DOUBLE_PARAMETER_EXPECTED

Double parameter expected

4065

ERR_ARRAY_AS_PARAMETER_EXPECTED

Array as parameter expected

4066

ERR_HISTORY_WILL_UPDATED

Requested history data is in updating state

4067

ERR_TRADE_ERROR

Internal trade error

4068

ERR_RESOURCE_NOT_FOUND

Resource not found

4069

ERR_RESOURCE_NOT_SUPPORTED

Resource not supported

4070

ERR_RESOURCE_DUPLICATED

Duplicate resource

4071

ERR_INDICATOR_CANNOT_INIT

Custom indicator cannot initialize

4072

ERR_INDICATOR_CANNOT_LOAD

Cannot load custom indicator

4073

ERR_NO_HISTORY_DATA

No history data

4074

ERR_NO_MEMORY_FOR_HISTORY

No memory for history data

4075

ERR_NO_MEMORY_FOR_INDICATOR

Not enough memory for indicator calculation

4099

ERR_END_OF_FILE

End of file

4100

ERR_SOME_FILE_ERROR

Some file error

4101

ERR_WRONG_FILE_NAME

Wrong file name

4102

ERR_TOO_MANY_OPENED_FILES

Too many opened files

4103

ERR_CANNOT_OPEN_FILE

Cannot open file

4104

ERR_INCOMPATIBLE_FILEACCESS

Incompatible access to a file

4105

ERR_NO_ORDER_SELECTED

No order selected

4106

ERR_UNKNOWN_SYMBOL

Unknown symbol

4107

ERR_INVALID_PRICE_PARAM

Invalid price

4108

ERR_INVALID_TICKET

Invalid ticket

4109

ERR_TRADE_NOT_ALLOWED

Trade is not allowed. Enable checkbox "Allow live trading" in the Expert Advisor properties

4110

ERR_LONGS_NOT_ALLOWED

Longs are not allowed. Check the Expert Advisor properties

4111

ERR_SHORTS_NOT_ALLOWED

Shorts are not allowed. Check the Expert Advisor properties

4112

ERR_TRADE_EXPERT_DISABLED_BY_SERVER

Automated trading by Expert Advisors/Scripts disabled by trade server

4200

ERR_OBJECT_ALREADY_EXISTS

Object already exists

4201

ERR_UNKNOWN_OBJECT_PROPERTY

Unknown object property

4202

ERR_OBJECT_DOES_NOT_EXIST

Object does not exist

4203

ERR_UNKNOWN_OBJECT_TYPE

Unknown object type

4204

ERR_NO_OBJECT_NAME

No object name

4205

ERR_OBJECT_COORDINATES_ERROR

Object coordinates error

4206

ERR_NO_SPECIFIED_SUBWINDOW

No specified subwindow

4207

ERR_SOME_OBJECT_ERROR

Graphical object error

4210

ERR_CHART_PROP_INVALID

Unknown chart property

4211

ERR_CHART_NOT_FOUND

Chart not found

4212

ERR_CHARTWINDOW_NOT_FOUND

Chart subwindow not found

4213

ERR_CHARTINDICATOR_NOT_FOUND

Chart indicator not found

4220

ERR_SYMBOL_SELECT

Symbol select error

4250

ERR_NOTIFICATION_ERROR

Notification error

4251

ERR_NOTIFICATION_PARAMETER

Notification parameter error

4252

ERR_NOTIFICATION_SETTINGS

Notifications disabled

4253

ERR_NOTIFICATION_TOO_FREQUENT

Notification send too frequent

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

5001

ERR_FILE_TOO_MANY_OPENED

Too many opened files

5002

ERR_FILE_WRONG_FILENAME

Wrong file name

5003

ERR_FILE_TOO_LONG_FILENAME

Too long file name

5004

ERR_FILE_CANNOT_OPEN

Cannot open file

5005

ERR_FILE_BUFFER_ALLOCATION_ERROR

Text file buffer allocation error

5006

ERR_FILE_CANNOT_DELETE

Cannot delete file

5007

ERR_FILE_INVALID_HANDLE

Invalid file handle (file closed or was not opened)

5008

ERR_FILE_WRONG_HANDLE

Wrong file handle (handle index is out of handle table)

5009

ERR_FILE_NOT_TOWRITE

File must be opened with FILE_WRITE flag

5010

ERR_FILE_NOT_TOREAD

File must be opened with FILE_READ flag

5011

ERR_FILE_NOT_BIN

File must be opened with FILE_BIN flag

5012

ERR_FILE_NOT_TXT

File must be opened with FILE_TXT flag

5013

ERR_FILE_NOT_TXTORCSV

File must be opened with FILE_TXT or FILE_CSV flag

5014

ERR_FILE_NOT_CSV

File must be opened with FILE_CSV flag

5015

ERR_FILE_READ_ERROR

File read error

5016

ERR_FILE_WRITE_ERROR

File write error

5017

ERR_FILE_BIN_STRINGSIZE

String size must be specified for binary file

5018

ERR_FILE_INCOMPATIBLE

Incompatible file (for string arrays-TXT, for others-BIN)

5019

ERR_FILE_IS_DIRECTORY

File is directory not file

5020

ERR_FILE_NOT_EXIST

File does not exist

5021

ERR_FILE_CANNOT_REWRITE

File cannot be rewritten

5022

ERR_FILE_WRONG_DIRECTORYNAME

Wrong directory name

5023

ERR_FILE_DIRECTORY_NOT_EXIST

Directory does not exist

5024

ERR_FILE_NOT_DIRECTORY

Specified file is not directory

5025

ERR_FILE_CANNOT_DELETE_DIRECTORY

Cannot delete directory

5026

ERR_FILE_CANNOT_CLEAN_DIRECTORY

Cannot clean directory

5027

ERR_FILE_ARRAYRESIZE_ERROR

Array resize error

5028

ERR_FILE_STRINGRESIZE_ERROR

String resize error

5029

ERR_FILE_STRUCT_WITH_OBJECTS

Structure contains strings or dynamic arrays

5200

ERR_WEBREQUEST_INVALID_ADDRESS

Invalid URL

5201

ERR_WEBREQUEST_CONNECT_FAILED

Failed to connect to specified URL

5202

ERR_WEBREQUEST_TIMEOUT

Timeout exceeded

5203

ERR_WEBREQUEST_REQUEST_FAILED

HTTP request failed

 

User errors

 

65536

ERR_USER_ERROR_FIRST

User defined errors start with this code