Errors & return codes
Every reply carries ERROR_ID and ERROR_DESCRIPTION. ERROR_ID = 0 means MetaTrader processed the command successfully. Any other value is an error, and ERROR_DESCRIPTION says what went wrong.
Common ERROR_ID values
Section titled “Common ERROR_ID values”| ERROR_ID | Meaning | What to do |
|---|---|---|
0 |
Success | — |
404 |
Unknown REST endpoint | Check the path and HTTP method |
4003 |
Invalid or missing parameter | Read ERROR_DESCRIPTION; it names the tag |
4109 |
Trading not allowed | Turn on Algo Trading, or the account is not demo while the demo-only lock is on |
4301 |
Unknown symbol | Use the broker’s exact name — see /v1/symbol/list |
4304 |
No price for the symbol yet | Market closed or symbol not yet loaded; retry |
4401 |
History not ready | MT5 is downloading the data; ask again in a moment |
4753 |
Order or position not found | Check the ticket |
4756 |
Trade request failed | See RETCODE and ERROR_DESCRIPTION |
9001 |
License required | Live accounts need a paid license — see License |
9002 |
Free session ended | The free version runs 7 hours per session — restart MetaTrader 5 or install a license |
Other values are standard MQL5 runtime error codes.
Trade RETCODE
Section titled “Trade RETCODE”Order commands also return MT5’s trade server code in RETCODE:
| RETCODE | Meaning |
|---|---|
10008 |
Order placed |
10009 |
Request completed |
10010 |
Partially completed |
10004 |
Requote |
10006 |
Rejected |
10013 |
Invalid request |
10014 |
Invalid volume |
10015 |
Invalid price |
10016 |
Invalid stops (SL/TP) |
10018 |
Market closed |
10019 |
Not enough money |
10030 |
Unsupported filling mode |
The full list is in the MQL5 documentation under Trade Server Return Codes.