Troubleshooting
MT5 Trade Return Codes Explained: What 10004, 10014, 10016, 10019, 10027 and 10030 Mean and How to Fix Them
By Benjamin Lee · Updated · 6 min read
When an Expert Advisor fails to open or close a trade, the terminal writes a number in the Experts tab: 10016, 10019, 10030 and so on. Those numbers are trade server return codes, and each one tells you why the broker refused the request. They look cryptic, but most have a short list of causes and a simple fix. This guide explains the codes you are most likely to meet, groups them by what to do about them, and shows a method for working out which one you have, so you can fix an EA that runs but does not trade.
Key takeaways
- A return code is the broker's reason for refusing or finishing a trade request.
- 10008, 10009 and 10010 mean the order was placed, done or partly done. The others are mostly refusals.
- Most refusals come from settings: volume, stops, filling mode, margin or permissions.
- Read the code, then read the message next to it in the journal. Together they point to the cause.
- If a code keeps repeating, change the setting. Do not leave the EA to retry for hours.
Where the codes appear
Open the Toolbox window at the bottom of MT5 and choose the Experts tab. When an EA's order request fails, it usually prints a line with the function name, the code and a short message. The Journal tab shows terminal and server events, such as disconnects. MetaQuotes lists every code in its MQL5 reference on trade server return codes. The table below covers the ones EA users meet most.
Success codes
| Code | Name | Meaning |
|---|---|---|
| 10008 | Order placed | A pending order was placed |
| 10009 | Request completed | The request was executed |
| 10010 | Only part of the request was completed | A partial fill happened |
The most common refusal codes
| Code | Meaning | Usual cause | What to try |
|---|---|---|---|
| 10004 | Requote | Price changed before the order arrived | Raise the allowed deviation or retry; common in fast markets |
| 10006 | Request rejected | The server refused for its own reasons | Retry later; check the broker's trading hours and rules |
| 10013 | Invalid request | A field in the request is wrong | Check the EA's inputs; contact the seller |
| 10014 | Invalid volume | Lot size is below the minimum, above the maximum or not on the lot step | Fix the lot; see invalid stops and volume |
| 10015 | Invalid price | The price is wrong or not rounded to the symbol's digits | Check normalisation and the symbol suffix |
| 10016 | Invalid stops | Stop loss or take profit is too close to the price or on the wrong side | Widen the stops; check the stops level |
| 10017 | Trade is disabled | Trading is not allowed for this account or symbol | Check account permissions and the symbol's trade mode |
| 10018 | Market is closed | The symbol is outside its trading session | Wait for the session; check holidays |
| 10019 | There is not enough money | Free margin is too low for the volume | Reduce lot size or add funds; check leverage |
| 10020 | Prices changed | Price moved between request and processing | Allow more deviation or retry |
| 10021 | There are no quotes | No current price for the symbol | Check the connection and the symbol in Market Watch |
| 10024 | Too frequent requests | The EA sends orders faster than the server allows | Slow the EA's requests; see the broker's limits |
| 10025 | No changes in request | A modify request changed nothing | Usually harmless; the EA should check before modifying |
| 10026 | Autotrading disabled by server | The broker has switched off algo trading for the account | Contact the broker |
| 10027 | Autotrading disabled by client terminal | The Algo Trading button is off or the EA is not allowed to trade | Turn on Algo Trading and tick Allow Algo Trading in the EA's properties |
| 10030 | Invalid fill type | The filling mode is not supported for the symbol | Change the EA's filling input; see filling modes |
| 10031 | No connection with the trade server | The terminal is disconnected | Check the connection or VPS |
| 10033 | Pending order limit reached | The account cannot hold more pending orders | Reduce the number of orders or ask the broker |
| 10034 | Volume limit reached for the symbol | Total volume of orders and positions hit the cap | Reduce size or close positions |
| 10040 | Open positions limit reached | The account cannot hold more positions | Close some or ask the broker |
A method for finding the cause
Step 1: Copy the exact line from the Experts tab
Note the time, the code, the message and the symbol. Repeated codes at the same moment tell you it is systematic.
Step 2: Group the code
Is it a setting (10014, 10016, 10030), money (10019), permissions (10017, 10026, 10027) or market conditions (10004, 10018, 10020)?
Step 3: Check the symbol specification
Right-click the symbol in Market Watch and choose Specification. Compare the minimum lot, lot step, stops level, trade mode and filling modes with the EA's inputs.
Step 4: Check the account
Confirm the Algo Trading button is on, the account allows EAs, the free margin is enough and the server is connected.
Step 5: Change one thing at a time
Adjust the single setting suggested by the code, then watch the next attempt in the Experts tab.
Step 6: Contact the seller with the journal text
If the EA offers no input to fix it, send the exact lines and the broker name.
When the EA keeps retrying
Some EAs retry a refused order again and again. That fills the journal and can trigger code 10024, too many requests, which makes things worse. If you see the same code repeating, switch the EA off while you fix the setting. If the code is 10031 or the terminal shows a red connection, check the internet or the VPS before changing the EA. Our guides to the AutoTrading and error fixes and common MT5 errors cover related causes, such as errors 4752 and 4756.
Return codes versus runtime errors
Return codes starting with 10 come from the trade server. Runtime errors, such as 4756 for a failed trade request, come from the terminal when a function call goes wrong. They often appear together: a failed OrderSend produces a runtime error and the server code that explains it. Look for both. The MQL5 runtime errors list explains the second kind.
Sources and further reading
- MQL5 Reference: Trade Server Return CodesWhat the codes returned for a refused trade request mean, including 10027.
- MQL5 Reference: Runtime ErrorsMeaning of terminal error codes such as 4752 and 4756.
- MQL5 Reference: Trade Request StructureThe magic field an Expert Advisor uses to tag its own orders.
Frequently asked questions
What does error 10016 mean in MT5?
Invalid stops. The stop loss or take profit is too close to the current price, on the wrong side, or not allowed by the symbol's stops level. Widen the stops or check the specification.
What does error 10019 mean?
There is not enough money. Free margin cannot cover the requested volume. Reduce the lot size, add funds or check the leverage.
What does error 10027 mean?
Autotrading is disabled by the client terminal. Turn on the Algo Trading button and tick Allow Algo Trading in the EA's properties.
What does error 10030 mean?
Invalid fill type. The EA asked for a filling mode the symbol does not support. Change the EA's filling input to one the symbol allows.
Where do I see return codes in MT5?
In the Experts tab of the Toolbox window. The Journal tab shows terminal and server events such as disconnects.
Expert Advisors in these styles
Apply the checks above to any of these before you buy: read the manual, run your own backtest, and start on demo.
Keep reading
- TroubleshootingMT5 Order Filling Modes Explained: FOK, IOC and ReturnMT5 order filling modes explained: Fill or Kill, Immediate or Cancel and Return, how brokers support them, and how to fix the invalid filling type error 10030.
- Pillar guideMT5 Expert Advisors: The Complete Guide for BeginnersEverything about MetaTrader 5 Expert Advisors in one place: how they work, strategy types, risk, backtesting, buying safely, gold, EURUSD, prop firms and Europe.
- EA basicsHow to Install and Run an EA on MT5Install an Expert Advisor on MetaTrader 5, load a setfile, set safe risk limits, and run it on a VPS. A practical walkthrough with a pre-live checklist.
- Gold EAsXAUUSD EA Settings: Lot Size, Stop Loss, Spread, HoursWhat each XAUUSD Expert Advisor input does and how to size it: lot size, stop loss, spread filter, slippage, trading hours and magic number, with euro examples.


