MT5APIConstants.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. #include "MT5APITypes.h"
  8. //+------------------------------------------------------------------+
  9. //| MetaTrader 5 API return codes |
  10. //+------------------------------------------------------------------+
  11. enum EnMTAPIRetcode
  12. {
  13. //--- successfully codes
  14. MT_RET_OK =0, // ok
  15. MT_RET_OK_NONE =1, // ok, no data
  16. //--- common errors
  17. MT_RET_ERROR =2, // Common error
  18. MT_RET_ERR_PARAMS =3, // Invalid parameters
  19. MT_RET_ERR_DATA =4, // Invalid data
  20. MT_RET_ERR_DISK =5, // Disk error
  21. MT_RET_ERR_MEM =6, // Memory error
  22. MT_RET_ERR_NETWORK =7, // Network error
  23. MT_RET_ERR_PERMISSIONS =8, // Not enough permissions
  24. MT_RET_ERR_TIMEOUT =9, // Operation timeout
  25. MT_RET_ERR_CONNECTION =10, // No connection
  26. MT_RET_ERR_NOSERVICE =11, // Service is not available
  27. MT_RET_ERR_FREQUENT =12, // Too frequent requests
  28. MT_RET_ERR_NOTFOUND =13, // Not found
  29. MT_RET_ERR_PARTIAL =14, // Partial error
  30. MT_RET_ERR_SHUTDOWN =15, // Server shutdown in progress
  31. MT_RET_ERR_CANCEL =16, // Operation has been canceled
  32. MT_RET_ERR_DUPLICATE =17, // Duplicate data
  33. //--- authentication retcodes
  34. MT_RET_AUTH_CLIENT_INVALID =1000, // Invalid terminal type
  35. MT_RET_AUTH_ACCOUNT_INVALID =1001, // Invalid account
  36. MT_RET_AUTH_ACCOUNT_DISABLED =1002, // Account disabled
  37. MT_RET_AUTH_ADVANCED =1003, // Advanced authorization necessary
  38. MT_RET_AUTH_CERTIFICATE =1004, // Certificate required
  39. MT_RET_AUTH_CERTIFICATE_BAD =1005, // Invalid certificate
  40. MT_RET_AUTH_NOTCONFIRMED =1006, // Certificate is not confirmed
  41. MT_RET_AUTH_SERVER_INTERNAL =1007, // Attempt to connect to non-access server
  42. MT_RET_AUTH_SERVER_BAD =1008, // Server isn't authenticated
  43. MT_RET_AUTH_UPDATE_ONLY =1009, // Only updates available
  44. MT_RET_AUTH_CLIENT_OLD =1010, // Client has old version
  45. MT_RET_AUTH_MANAGER_NOCONFIG =1011, // Manager account doesn't have manager config
  46. MT_RET_AUTH_MANAGER_IPBLOCK =1012, // IP address unallowed for manager
  47. MT_RET_AUTH_GROUP_INVALID =1013, // Group is not initialized (server restart neccesary)
  48. MT_RET_AUTH_CA_DISABLED =1014, // Certificate generation disabled
  49. MT_RET_AUTH_INVALID_ID =1015, // Invalid or disabled server id [check server's id]
  50. MT_RET_AUTH_INVALID_IP =1016, // Unallowed address [check server's ip address]
  51. MT_RET_AUTH_INVALID_TYPE =1017, // Invalid server type [check server's id and type]
  52. MT_RET_AUTH_SERVER_BUSY =1018, // Server is busy
  53. MT_RET_AUTH_SERVER_CERT =1019, // Invalid server certificate
  54. MT_RET_AUTH_ACCOUNT_UNKNOWN =1020, // Unknown account
  55. MT_RET_AUTH_SERVER_OLD =1021, // Old server version
  56. MT_RET_AUTH_SERVER_LIMIT =1022, // Server cannot be connected due to license limitation
  57. MT_RET_AUTH_MOBILE_DISABLED =1023, // Mobile connection aren't allowed in server license
  58. MT_RET_AUTH_MANAGER_TYPE =1024, // Connection type is not permitted for manager
  59. MT_RET_AUTH_DEMO_DISABLED =1025, // Demo allocation disabled
  60. MT_RET_AUTH_RESET_PASSWORD =1026, // Master password must be changed
  61. //--- config management retcodes
  62. MT_RET_CFG_LAST_ADMIN =2000, // Last admin config deleting
  63. MT_RET_CFG_LAST_ADMIN_GROUP =2001, // Last admin group cannot be deleted
  64. MT_RET_CFG_NOT_EMPTY =2003, // Accounts or trades in group/symbol
  65. MT_RET_CFG_INVALID_RANGE =2004, // Invalid accounts or trades ranges
  66. MT_RET_CFG_NOT_MANAGER_LOGIN =2005, // Manager account is not from manager group
  67. MT_RET_CFG_BUILTIN =2006, // Built-in protected config
  68. MT_RET_CFG_DUPLICATE =2007, // Configuration duplicate
  69. MT_RET_CFG_LIMIT_REACHED =2008, // Configuration limit reached
  70. MT_RET_CFG_NO_ACCESS_TO_MAIN =2009, // Invalid network configuration
  71. MT_RET_CFG_DEALER_ID_EXIST =2010, // Dealer with same ID exists
  72. MT_RET_CFG_BIND_ADDR_EXIST =2011, // Bind address already exists
  73. MT_RET_CFG_WORKING_TRADE =2012, // Attempt to delete working trade server
  74. MT_RET_CFG_GATEWAY_NAME_EXIST=2013, // Gateway with same name exists
  75. MT_RET_CFG_SWITCH_TO_BACKUP =2014, // Server must be switched to backup mode
  76. MT_RET_CFG_NO_BACKUP_MODULE =2015, // Backup server module is absent
  77. MT_RET_CFG_NO_TRADE_MODULE =2016, // Trade server module is absent
  78. MT_RET_CFG_NO_HISTORY_MODULE =2017, // History server module is absent
  79. MT_RET_CFG_ANOTHER_SWITCH =2018, // Another switching process in progress
  80. MT_RET_CFG_NO_LICENSE_FILE =2019, // License file is absent
  81. MT_RET_CFG_GATEWAY_LOGIN_EXIST=2020, // Gateway with same login already exist
  82. //--- client management retcodes
  83. MT_RET_USR_LAST_ADMIN =3001, // Last admin account deleting
  84. MT_RET_USR_LOGIN_EXHAUSTED =3002, // Logins range exhausted
  85. MT_RET_USR_LOGIN_PROHIBITED =3003, // Login reserved at another server
  86. MT_RET_USR_LOGIN_EXIST =3004, // Account already exists
  87. MT_RET_USR_SUICIDE =3005, // Attempt of self-deletion
  88. MT_RET_USR_INVALID_PASSWORD =3006, // Invalid account password
  89. MT_RET_USR_LIMIT_REACHED =3007, // Users limit reached
  90. MT_RET_USR_HAS_TRADES =3008, // Account has open trades
  91. MT_RET_USR_DIFFERENT_SERVERS =3009, // Attempt to move account to different server
  92. MT_RET_USR_DIFFERENT_CURRENCY=3010, // Attempt to move account to different currency group
  93. MT_RET_USR_IMPORT_BALANCE =3011, // Account balance import error
  94. MT_RET_USR_IMPORT_GROUP =3012, // Account import with invalid group
  95. MT_RET_USR_ACCOUNT_EXIST =3013, // Account already exist
  96. //--- trades management retcodes
  97. MT_RET_TRADE_LIMIT_REACHED =4001, // Orders or deals limit reached
  98. MT_RET_TRADE_ORDER_EXIST =4002, // Order already exists
  99. MT_RET_TRADE_ORDER_EXHAUSTED =4003, // Orders range exhausted
  100. MT_RET_TRADE_DEAL_EXHAUSTED =4004, // Deals range exhausted
  101. MT_RET_TRADE_MAX_MONEY =4005, // Money limit reached
  102. MT_RET_TRADE_DEAL_EXIST =4006, // Deal already exists
  103. MT_RET_TRADE_ORDER_PROHIBITED=4007, // Order ticket reserved at another server
  104. MT_RET_TRADE_DEAL_PROHIBITED =4008, // Deal ticket reserved at another server
  105. //--- report generation retcodes
  106. MT_RET_REPORT_SNAPSHOT =5001, // Base snapshot error
  107. MT_RET_REPORT_NOTSUPPORTED =5002, // Method doesn't support for this report
  108. MT_RET_REPORT_NODATA =5003, // No report data
  109. MT_RET_REPORT_TEMPLATE_BAD =5004, // Bad template
  110. MT_RET_REPORT_TEMPLATE_END =5005, // End of template (template success processed)
  111. MT_RET_REPORT_INVALID_ROW =5006, // Invalid row size
  112. MT_RET_REPORT_LIMIT_REPEAT =5007, // Tag repeat limit reached
  113. MT_RET_REPORT_LIMIT_REPORT =5008, // Report size limit reached
  114. //--- price history reports retcodes
  115. MT_RET_HST_SYMBOL_NOTFOUND =6001, // Symbol not found, try to restart history server
  116. //--- trade request retcodes
  117. MT_RET_REQUEST_INWAY =10001, // Request on the way
  118. MT_RET_REQUEST_ACCEPTED =10002, // Request accepted
  119. MT_RET_REQUEST_PROCESS =10003, // Request processed
  120. MT_RET_REQUEST_REQUOTE =10004, // Request Requoted
  121. MT_RET_REQUEST_PRICES =10005, // Request Prices
  122. MT_RET_REQUEST_REJECT =10006, // Request rejected
  123. MT_RET_REQUEST_CANCEL =10007, // Request canceled
  124. MT_RET_REQUEST_PLACED =10008, // Order from requestplaced
  125. MT_RET_REQUEST_DONE =10009, // Request executed
  126. MT_RET_REQUEST_DONE_PARTIAL =10010, // Request executed partially
  127. MT_RET_REQUEST_ERROR =10011, // Request common error
  128. MT_RET_REQUEST_TIMEOUT =10012, // Request timeout
  129. MT_RET_REQUEST_INVALID =10013, // Invalid request
  130. MT_RET_REQUEST_INVALID_VOLUME=10014, // Invalid volume
  131. MT_RET_REQUEST_INVALID_PRICE =10015, // Invalid price
  132. MT_RET_REQUEST_INVALID_STOPS =10016, // Invalid stops or price
  133. MT_RET_REQUEST_TRADE_DISABLED=10017, // Trade disabled
  134. MT_RET_REQUEST_MARKET_CLOSED =10018, // Market closed
  135. MT_RET_REQUEST_NO_MONEY =10019, // Not enough money
  136. MT_RET_REQUEST_PRICE_CHANGED =10020, // Price changed
  137. MT_RET_REQUEST_PRICE_OFF =10021, // No prices
  138. MT_RET_REQUEST_INVALID_EXP =10022, // Invalid order expiration
  139. MT_RET_REQUEST_ORDER_CHANGED =10023, // Order has been changed already
  140. MT_RET_REQUEST_TOO_MANY =10024, // Too many trade requests
  141. MT_RET_REQUEST_NO_CHANGES =10025, // Request doesn't contain changes
  142. MT_RET_REQUEST_AT_DISABLED_SERVER=10026, // AutoTrading disabled by server
  143. MT_RET_REQUEST_AT_DISABLED_CLIENT=10027, // AutoTrading disabled by client
  144. MT_RET_REQUEST_LOCKED =10028, // Request locked by dealer
  145. MT_RET_REQUEST_FROZEN =10029, // Order or position frozen
  146. MT_RET_REQUEST_INVALID_FILL =10030, // Unsupported filling mode
  147. MT_RET_REQUEST_CONNECTION =10031, // No connection
  148. MT_RET_REQUEST_ONLY_REAL =10032, // Allowed for real accounts only
  149. MT_RET_REQUEST_LIMIT_ORDERS =10033, // Orders limit reached
  150. MT_RET_REQUEST_LIMIT_VOLUME =10034, // Volume limit reached
  151. MT_RET_REQUEST_INVALID_ORDER =10035, // Invalid or prohibited order type
  152. MT_RET_REQUEST_POSITION_CLOSED=10036, // Position doesn't exist
  153. MT_RET_REQUEST_EXECUTION_SKIPPED =10037, // Execution doesn't belong to this server
  154. MT_RET_REQUEST_INVALID_CLOSE_VOLUME=10038, // Volume to be closed exceeds the position volume
  155. MT_RET_REQUEST_CLOSE_ORDER_EXIST =10039, // Order to close this position already exists
  156. MT_RET_REQUEST_LIMIT_POSITIONS=10040, // Positions limit reached
  157. MT_RET_REQUEST_REJECT_CANCEL =10041, // Request rejected, order will be canceled
  158. MT_RET_REQUEST_LONG_ONLY =10042, // Only long positions are allowed
  159. MT_RET_REQUEST_SHORT_ONLY =10043, // Only short positions are allowed
  160. MT_RET_REQUEST_CLOSE_ONLY =10044, // Only position closing is allowed
  161. MT_RET_REQUEST_PROHIBITED_BY_FIFO=10045, // Position close prohibited by FIFO rule
  162. //--- dealer retcodes
  163. MT_RET_REQUEST_RETURN =11000, // Request returned in queue
  164. MT_RET_REQUEST_DONE_CANCEL =11001, // Request partially filled, remainder has been canceled
  165. MT_RET_REQUEST_REQUOTE_RETURN=11002, // Request requoted and returned in queue with new prices
  166. //--- API retcodes
  167. MT_RET_ERR_NOTIMPLEMENT =12000, // Not implement yet
  168. MT_RET_ERR_NOTMAIN =12001, // Operation must be performed on main server
  169. MT_RET_ERR_NOTSUPPORTED =12002, // Command doesn't supported
  170. MT_RET_ERR_DEADLOCK =12003, // Operation canceled due possible deadlock
  171. MT_RET_ERR_LOCKED =12004 // Operation on locked entity
  172. };
  173. //+------------------------------------------------------------------+