ForexCopilotEA

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

Codes that mean the request went through
CodeNameMeaning
10008Order placedA pending order was placed
10009Request completedThe request was executed
10010Only part of the request was completedA partial fill happened

The most common refusal codes

Common refusal codes, causes and fixes
CodeMeaningUsual causeWhat to try
10004RequotePrice changed before the order arrivedRaise the allowed deviation or retry; common in fast markets
10006Request rejectedThe server refused for its own reasonsRetry later; check the broker's trading hours and rules
10013Invalid requestA field in the request is wrongCheck the EA's inputs; contact the seller
10014Invalid volumeLot size is below the minimum, above the maximum or not on the lot stepFix the lot; see invalid stops and volume
10015Invalid priceThe price is wrong or not rounded to the symbol's digitsCheck normalisation and the symbol suffix
10016Invalid stopsStop loss or take profit is too close to the price or on the wrong sideWiden the stops; check the stops level
10017Trade is disabledTrading is not allowed for this account or symbolCheck account permissions and the symbol's trade mode
10018Market is closedThe symbol is outside its trading sessionWait for the session; check holidays
10019There is not enough moneyFree margin is too low for the volumeReduce lot size or add funds; check leverage
10020Prices changedPrice moved between request and processingAllow more deviation or retry
10021There are no quotesNo current price for the symbolCheck the connection and the symbol in Market Watch
10024Too frequent requestsThe EA sends orders faster than the server allowsSlow the EA's requests; see the broker's limits
10025No changes in requestA modify request changed nothingUsually harmless; the EA should check before modifying
10026Autotrading disabled by serverThe broker has switched off algo trading for the accountContact the broker
10027Autotrading disabled by client terminalThe Algo Trading button is off or the EA is not allowed to tradeTurn on Algo Trading and tick Allow Algo Trading in the EA's properties
10030Invalid fill typeThe filling mode is not supported for the symbolChange the EA's filling input; see filling modes
10031No connection with the trade serverThe terminal is disconnectedCheck the connection or VPS
10033Pending order limit reachedThe account cannot hold more pending ordersReduce the number of orders or ask the broker
10034Volume limit reached for the symbolTotal volume of orders and positions hit the capReduce size or close positions
10040Open positions limit reachedThe account cannot hold more positionsClose some or ask the broker

A method for finding the cause

  1. 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.

  2. Step 2: Group the code

    Is it a setting (10014, 10016, 10030), money (10019), permissions (10017, 10026, 10027) or market conditions (10004, 10018, 10020)?

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Quick checks when an EA does not trade
0/8

Sources and further reading

  1. MQL5 Reference: Trade Server Return CodesWhat the codes returned for a refused trade request mean, including 10027.
  2. MQL5 Reference: Runtime ErrorsMeaning of terminal error codes such as 4752 and 4756.
  3. 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.

Browse Expert Advisors