MetaTrader Error Codes Explained: Why Orders Get Rejected
A trade that does not go through leaves a number behind: a three-digit code such as 130 or 138 in MetaTrader 4, a five-digit one such as 10016 or 10019 in MetaTrader 5. Almost everything written about those numbers is written for someone about to edit an expert advisor.
The trader who clicked Buy and got a red message box needs something else. Not the constant name, and not the source code that handles it, but one answer: what condition produced this, and what has to change before the next attempt.
The codes are named below because the terminal shows them, but what organises the page is the condition behind each one, and where that condition lives.
Key takeaways
- Some rejections happen inside your own terminal and the order never reaches the broker. Others are answers from the trade server. The fix differs in each case.
- MetaTrader 4 mixes both kinds into one numbering range and MetaTrader 5 separates them, which is why one problem carries two unrelated numbers across the platforms.
- Invalid stops covers two distinct server rules, one about distance from price and one about a pending order that is close to filling.
- Off quotes and requote are different events with different remedies, and they are routinely described as one thing.
- Not enough money is measured against free margin, not the account balance, so it can fire while the balance looks ample.
- Several values in this area are per-symbol settings chosen by each broker, so no figure for them can be stated here at all.
Table of contents
- Where the Rejection Actually Happened
- Invalid Stops: Two Distance Rules Behind One Message
- Off Quotes and Requote Are Not the Same Rejection
- Not Enough Money When the Balance Looks Fine
- Trade Is Disabled and Market Is Closed
- Fill Policy Rejections That Exist in MT5 and Not in MT4
- Finding Which Code Fired, and What the Log Will Not Tell You
- What to Change Before You Retry
- Who This Page Is Not For
- Frequently Asked Questions
Where the Rejection Actually Happened
Two very different things are both called an error here, and separating them settles most of the confusion in one step.
The first kind never leaves your computer. The terminal refuses the request before sending it, because a setting on your side forbids it. MetaTrader 4 numbers these in the 4000 range: code 4109 means live trading is switched off in the expert advisor properties. Nothing was asked of the broker at all.
The second kind is an answer. The request reached the trade server, which evaluated it and sent back a result. In MetaTrader 4 those answers occupy the 100 range. MetaTrader 5 gives them a category of their own, the trade server return codes, running from 10004 upward, where even success has a number: 10009.
The consequence is direct. A terminal-side refusal is fixed on your machine, and retrying before you do is pointless. A server answer is a statement about the account, the symbol or the market, and one of those is what has to change.
Invalid Stops: Two Distance Rules Behind One Message
Invalid stops, code 130 on MetaTrader 4 and 10016 on MetaTrader 5, is the most common rejection a discretionary trader meets, and one message hides two separate server rules.
The first sets a minimum distance between the current price and any protective level or resting order price you attach. Place one closer than that and the server refuses the entire request, including the market order attached to it.
The second applies to an order already sitting on the server that has come close to its trigger price. Inside that zone the order is frozen: it cannot be modified or deleted until price moves away. The same message appears, but nothing about the stop distance was wrong. The timing of the modification was.
Both distances are per-symbol settings held by the broker, and both can be zero, meaning no restriction. Neither can be given as a number here, because each broker sets its own and can change one symbol without touching another. How to read the current values is on our page about stops level and freeze level.
Off Quotes and Requote Are Not the Same Rejection
MetaTrader 4 gives these separate codes, 136 for off quotes and 138 for requote, and the platform documentation gives them separate names. They are frequently treated as one problem with one fix.
A requote is a counter-offer. The price you asked for is gone, so the server returns the price that is available and waits for you to accept or decline. Something was on the other side; it was not at your number. Widening the maximum deviation you accept addresses it, and trades a worse fill for a higher chance of one, as set out on our page about requotes and slippage.
Off quotes says something else: the server has no usable price for that symbol at that moment. That is a liquidity or feed condition, and raising your deviation tolerance does nothing because there is no alternative price to accept. Off quotes around a scheduled release is the market state itself rather than a fault in the order.
MetaTrader 5 keeps requote as 10004 and routes the no-price condition through its generic rejection and invalid-price results, which is one reason the mapping between the platforms is less tidy than it looks.
Not Enough Money When the Balance Looks Fine
Code 134 on MetaTrader 4 and 10019 on MetaTrader 5 both report a funding shortfall against what was asked for. The balance is not what is being tested.
The server checks free margin: the equity left after the margin already committed to open positions has been set aside. A balance of several thousand with most of it tied up behind existing trades leaves very little free, and the new position is measured against that remainder.
Three things move free margin while the balance sits still. Open positions running against you reduce equity. A leverage change on your account, or on one symbol, changes what a lot costs to hold. And symbols differ: an index or a metal can require far more margin per lot than a major currency pair.
The pending-order case surprises people. An order accepted when placed is checked again at the moment it triggers, and the platform documentation states that if free margin is insufficient then, the order is canceled and moved to history with the rejected status. Nothing was wrong with the order; the account changed underneath it. The levels a broker acts on are covered on our page about free margin.
Trade Is Disabled and Market Is Closed
These two, 133 and 132 on MetaTrader 4 and 10017 and 10018 on MetaTrader 5, both mean the switch is not yours to flip.
Market is closed catches people out more often than it should. Each symbol carries its own session times, expressed in the server clock rather than yours. One symbol can be closed while another on the same platform trades, and the daily break on a symbol that appears to run around the clock is set by the broker.
Trade is disabled is broader. The symbol may be set to close-only, so new positions are refused while existing ones can still be reduced. The account itself may be restricted, which happens on read-only credentials and on accounts pending verification. Or it may be temporary, applied while a corporate action or an expiry is processed.
Neither has a client-side remedy, but telling them apart still matters: market is closed resolves on the clock, trade is disabled when the broker changes something.
Fill Policy Rejections That Exist in MT5 and Not in MT4
MetaTrader 5 return code 10030, invalid order filling type, has no MetaTrader 4 equivalent, so a trader who has just migrated has never met it.
MetaTrader 5 lets an order carry a fill policy alongside its volume and price, and the platform documentation describes three. Fill or Kill executes only in the volume specified, and where that much is not on offer nothing is executed at all. Immediate or Cancel takes whatever part is available and cancels the rest. Return leaves the unfilled remainder live, and is documented as applying to market, limit and stop limit orders.
The rejection appears when the policy attached to the order is one the broker does not permit for that symbol and order type. It is a mismatch between request and symbol configuration, not a shortage, and the remedy is to pick a policy the symbol accepts.
The same setting governs whether a partial fill is possible at all, which our page about order fill policy works through.
Finding Which Code Fired, and What the Log Will Not Tell You
The message box shows the text and closes. The number stays in the terminal logs, and knowing which log to open is most of the work.
Requests you sent by hand, and the server answers to them, go to the Journal. Anything raised by an expert advisor or an indicator goes to the Experts tab, which is why a rejection a running robot met can be invisible to someone reading only the Journal. Both tabs are covered on our page about the Journal and Experts tabs.
One limit is worth knowing first. The log records the code and the request, not the server-side value that produced it. It will show that stops were invalid; it will not print the minimum distance in force at that second. That has to be read from the symbol specification, and it can have changed since.
What to Change Before You Retry
The table maps each rejection to its condition and to the one thing worth changing. Where nothing on your side will help, it says so.
| MT4 | MT5 | Condition behind it | Where it lives | What to change |
|---|---|---|---|---|
| 130 | 10016 | Stop too close, or order frozen near its trigger | Server, per symbol | Widen the stop, or wait for price to leave the frozen zone |
| 138 | 10004 | Price moved; a different price is offered | Server | Accept the new price, or raise the deviation you allow |
| 136 | 10006 or 10015 | No usable price for the symbol right now | Market and feed | Nothing on your side; deviation does not help |
| 134 | 10019 | Free margin below what the position requires | Account | Reduce volume, close something, or add funds |
| 131 | 10014 | Volume outside the minimum, maximum or step | Server, per symbol | Round the volume to the step the symbol allows |
| 132 | 10018 | Symbol outside its session on the server clock | Server, per symbol | Nothing; wait for the session |
| 133 | 10017 | Symbol or account restricted by the broker | Broker | Nothing; ask which restriction applies |
| none | 10030 | Fill policy not permitted for that symbol | Server, per symbol | Select a fill policy the symbol accepts |
| 4109 | 10027 | Automated trading switched off on your side | Your terminal | Enable it in the terminal and in the program properties |
Who This Page Is Not For
Anyone writing an expert advisor needs the full enumerations rather than this subset, including the codes a manual trader will never see. The MQL references carry every constant, its value and its exact wording.
It is also not a substitute for asking. Two entries above resolve only when the broker changes something, and the route there is the symbol specification plus a ticket quoting the code and the timestamp.
Frequently Asked Questions
What does invalid stops mean in MetaTrader?
The trade server refused the request because a protective level or a resting order price broke one of two distance rules. Either the level was nearer to current price than the minimum the broker allows on that symbol, or the order was already inside the frozen zone around its trigger price and could not be modified at that moment.
Why does MetaTrader say not enough money when the balance is sufficient?
Because the test is free margin rather than balance. Margin already committed to open positions is set aside, and only what remains is measured against the margin the new position requires, so a large balance with most of it tied up can still fail the check.
Is an off quotes message the same as a requote?
No, and MetaTrader 4 gives them separate codes for that reason. A requote is a counter-offer at a price that does exist and can be accepted. Off quotes reports that no usable price is available for that symbol at that moment, so raising the deviation setting changes nothing.
Do MT4 and MT5 use the same error numbers?
No. MetaTrader 4 answers from the trade server sit in the 100 range, while MetaTrader 5 uses a separate set of trade server return codes beginning at 10004. Several conditions map across one to one, but the numbers do not, and at least one MetaTrader 5 code has no MetaTrader 4 counterpart.
Where does MetaTrader record the code for a rejected order?
Manual requests and the server answers to them go to the Journal tab. Anything raised by an expert advisor or an indicator is written to the Experts tab instead, so a rejection met by a running program can be absent from the log a trader is reading.
Sources checked 12 August 2026. MetaQuotes, MQL5 Reference, Trade Server Return Codes · MetaQuotes, MQL4 Reference, Error Codes · MetaQuotes, MetaTrader 5 Help, Types of Orders and Order Execution.
Disclaimer: This page is educational information about how a trading terminal reports rejected orders. It is not investment advice, not a recommendation to trade any instrument, and not a statement of any broker current settings. Trading leveraged products carries a high risk of losing money rapidly. Check every per-symbol value in your own terminal and with your own broker before acting on it.
