MT5 Invalid Stops Error 10016: Causes and the Fix

Published November 20, 2026 · In Trading Guides

The MT5 invalid stops error is return code 10016: the trade server refused the request because a stop loss, take profit or pending order price breaks the symbol’s rules. In practice the price is too close to the market, on the wrong side of it, or not a valid price step. Your broker sets those limits, and an EA can read every one of them before it sends an order. Every platform fact comes from MetaQuotes’ MQL5 reference, the MQL5 book and the MetaTrader 5 help, checked on 19 November 2026.

What the MT5 invalid stops error means

The MQL5 list of trade server return codes gives it as TRADE_RETCODE_INVALID_STOPS, code 10016, with the text “Invalid stops in the request”. A manual order hits the same wall. The MetaTrader 5 help says that in this case the “Invalid stops” alert appears and the order is not accepted.

The server rejects only that one request, so an open position keeps its old stops and a new order is simply not placed. Three neighbouring codes are easy to confuse with it:

Seeing 10016 tells you the problem is in the SL, TP or pending price. If your EA sends no order at all and the log is silent, that is a different problem, covered in our guide to an MT5 EA not trading.

MT5 invalid stops error 10016: where a buy and a sell position may place stop loss and take profit relative to Bid and Ask
A buy is protected at Bid, a sell at Ask. Each stop must sit on its own side and outside the stops level.

Stops level and freeze level

Each symbol carries two distances, both in points, and most MT5 invalid stops rejections trace back to the first one. Both appear in the symbol’s Specification window. In code, SymbolInfoInteger returns them.

Property MetaQuotes description What it blocks
SYMBOL_TRADE_STOPS_LEVEL Minimal indention in points from the current close price to place Stop orders New SL, TP and pending prices closer than this
SYMBOL_TRADE_FREEZE_LEVEL Distance to freeze trade operations in points Changes to orders and stops already near the price

The MetaTrader 5 help describes the stops level as a channel around the current price inside which you can’t place a Stop Loss, Take Profit or pending order. The MQL5 book chapter on order distance adds two details. A non-zero stops level also stops you moving an open position’s SL or TP closer than that distance, and it stops you moving a pending order’s price closer too.

Its partner, the freeze level, works on orders and stops that already exist. When it is non-zero, a pending order whose price is nearer than this distance is frozen, and so are a position’s SL and TP once the price comes that close. A trailing stop or breakeven routine runs into it most often. Usually the server answers 10029 there, not 10016.

A worked example with made-up numbers: EURUSD with 5 digits has a point of 0.00001. A stops level of 30 means 30 points, or 0.00030. With Bid at 1.08500, a buy’s stop loss can sit no higher than 1.08470.

Stops level and freeze level compared: SYMBOL_TRADE_STOPS_LEVEL limits new stops, SYMBOL_TRADE_FREEZE_LEVEL locks existing ones near the price
The stops level limits what you can set. The freeze level limits what you can still change.

Which side SL and TP must be on

The MetaTrader 5 help on trading gives four placement rules:

A buy opens at Ask, yet its stops are measured from Bid, because that is the price a buy closes at. The MQL5 book says the same: for buy orders opened at Ask, protective levels indicate Bid, and sells use Ask. So the spread sits between your entry and the stop.

That detail explains a classic pattern. An EA computes the SL from the entry price, the spread widens at a news release or the daily rollover, and an order that worked all week fails with the MT5 invalid stops error for an hour. Measure from the closing price and add a margin above the stops level, and that cause goes away.

Units cause another common mistake. A stop of 20 means 20 points to one EA and 20 pips to another. On a 5-digit quote that is a tenfold difference, so a stop meant to be wide can land inside the stops level, a quiet source of MT5 invalid stops rejections.

Pending order distances

Pending orders follow the same channel, measured from a different price. According to the MQL5 book, buy pending orders (Buy Stop, Buy Limit, Buy Stop Limit) are measured from Ask and sell pending orders from Bid.

Order Price must be Measured from
Buy Limit Below the current price Ask
Buy Stop Above the current price Ask
Sell Limit Above the current price Bid
Sell Stop Below the current price Bid

In both cases the gap must be at least the stops level. A Buy Stop 10 points above Ask returns MT5 invalid stops when the stops level is 30. So does a Buy Limit sent above Ask, which is simply the wrong order type for that price. For a Buy Stop Limit, the stoplimit field is the Limit price placed once the stop price is reached, so it needs its own sanity check.

MT5 pending order distances: Buy Limit and Buy Stop measured from Ask, Sell Limit and Sell Stop from Bid, each outside the stops level channel
Buy pending orders count from Ask, sell pending orders from Bid. Nothing may sit inside the grey channel.

Round prices to the tick size

A price can be on the correct side, far enough away, and still come back as MT5 invalid stops because it is not a valid price. The NormalizeDouble() reference says calculated values of StopLoss, TakeProfit and pending prices must be normalized to the accuracy given by Digits(). A computed SL such as 1.084699999 needs rounding before it goes out.

Tick size is the second check. SYMBOL_TRADE_TICK_SIZE is the “Minimal price change”, and on some instruments, often indices and metals, it is larger than one point. Take a hypothetical index with 2 digits and a tick size of 0.25. A price of 18250.30 has the right number of digits, but it is not a whole number of ticks. Round to the tick first, then to the digits, and it becomes 18250.25.

Rounding a stop loss price to SYMBOL_TRADE_TICK_SIZE and then NormalizeDouble with the symbol digits
Two steps: snap to the tick grid, then normalize to the symbol’s digits.

Market execution: stops after the fill

The symbol properties page lists four execution modes in SYMBOL_TRADE_EXEMODE. Under Market execution, the broker makes a decision about the execution price without further discussion with the trader. Your stops are therefore checked against a price you did not choose.

In the trade request structure reference, the required fields for Market and Exchange execution do not include sl or tp. The same page describes TRADE_ACTION_SLTP, which changes the StopLoss and TakeProfit of an open position. That gives a safe pattern for ECN and other market-execution accounts:

  1. Send the market order with sl and tp at 0.
  2. Read the actual fill price and the current Bid or Ask.
  3. Rebuild SL and TP from those prices, round them, and check the distance again.
  4. Send a TRADE_ACTION_SLTP request for that position.

Brokers differ: some accept stops with the market order and some do not. If yours answers MT5 invalid stops on the opening request only, this two-step method is the usual fix. The position is open without a stop for a moment between the steps, so the EA must log any failure on the second request.

Check the request before OrderSend

An EA or a signal copier should never let the server be its first validator. A copier meets MT5 invalid stops more often than a hand-written EA: the signal’s SL was chosen for the provider’s broker and price, and your broker may have a wider stops level or different digits. Our Telegram signal copier guide explains how signals reach MT5. Whatever the source, run the same steps before every order:

  1. Read the stops level, freeze level, tick size and digits for the symbol.
  2. Round every price to the tick, then to the digits.
  3. Check the side and the distance from the right price, Bid or Ask.
  4. Call OrderCheck() and read its retcode.
  5. Send with OrderSend() and log the result’s retcode.

In MQL5, steps 1 to 3 need two small functions. They use only standard MQL5 functions, but we have not compiled or run them, so treat them as an example to adapt, not tested production code.

// MQL5 example (not compiled or run): round a price and check SL/TP for a market order
double NormPrice(const double price)
  {
   double tick = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE);
   double p = (tick > 0) ? MathRound(price / tick) * tick : price;
   return(NormalizeDouble(p, _Digits));
  }

bool StopsFit(const ENUM_ORDER_TYPE type, const double sl, const double tp)
  {
   long   level = SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL);
   double gap   = (level + 5) * _Point;              // 5 points of our own margin
   double bid   = SymbolInfoDouble(_Symbol, SYMBOL_BID);
   double ask   = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   if(type == ORDER_TYPE_BUY)                         // buy stops are measured from Bid
      return((sl == 0 || bid - sl >= gap) && (tp == 0 || tp - bid >= gap));
   if(type == ORDER_TYPE_SELL)                        // sell stops are measured from Ask
      return((sl == 0 || sl - ask >= gap) && (tp == 0 || ask - tp >= gap));
   return(false);
  }

Steps 4 and 5: OrderCheck() and OrderSend()

The last two steps use OrderCheck(). It returns false when funds are short or the request is filled out incorrectly. A true result is not a promise, though, as the reference notes, so the EA still reads the retcode after sending:

// MQL5 example (not compiled or run): check, then send, and log both answers
bool CheckThenSend(MqlTradeRequest &req)
  {
   MqlTradeCheckResult check = {};
   MqlTradeResult      res   = {};
   if(!OrderCheck(req, check))
     {
      PrintFormat("OrderCheck refused: retcode %u, %s", check.retcode, check.comment);
      return(false);                                  // fix the request, do not resend as is
     }
   if(!OrderSend(req, res))
      PrintFormat("OrderSend error %d", GetLastError());
   PrintFormat("retcode %u: %s", res.retcode, res.comment);
   return(res.retcode == TRADE_RETCODE_DONE || res.retcode == TRADE_RETCODE_PLACED);
  }

When the check fails, decide what the EA should do: widen the stop to the minimum, skip the trade, or wait for the next tick. Never resend the same request in a loop. Repeating an MT5 invalid stops request on every tick fills the log and changes nothing.

Pre-trade check for an EA or copier: read symbol limits, round prices, check side and distance, OrderCheck, then OrderSend and log the retcode
Five steps before every order. On market execution, the stops go out as a separate SLTP request after the fill.

Have the .mq5 source? These checks fit in a few functions. A compiled .ex5 file cannot be edited, so for a bought EA ask its seller first. For a custom fix, see our MT5 EA development service or send us the EA and its Journal log on WhatsApp for a fixed quote. New to EAs? Start with what an Expert Advisor is.

MT5 invalid stops: FAQ

What is error 10016 in MT5?

It is TRADE_RETCODE_INVALID_STOPS, “Invalid stops in the request”. Something in the SL, TP or pending price broke one of the symbol’s rules: distance, side or price step.

Where do I find the stops level for a symbol?

Open the contract specification from the Market Watch context menu, or call SymbolInfoInteger with SYMBOL_TRADE_STOPS_LEVEL in MQL5. The value is in points, not pips.

Why is a buy stop loss checked against Bid?

A buy position closes at Bid, so MetaQuotes measures its protective levels from Bid. A sell closes at Ask, so its levels are measured from Ask.

Why can’t my EA move a stop loss near the price?

The freeze level locks stops and pending orders that are closer to the price than that distance. The server then refuses the change, usually with code 10029.

Does the invalid stops error close my trade?

No. The server rejects only that request. An open position keeps its previous stops, so correct the prices and send a new request.

Risk warning: Trading forex, CFDs and other leveraged products carries a high risk of loss. A correct stop loss limits the damage of one trade under normal conditions, but gaps and slippage can still fill it at a worse price. Test any EA on a demo account first. This article is for education only and is not investment advice.

Want this built for you?

We develop it as a service — reliable, tested, and yours to own.

Message Us on WhatsApp
WhatsApp