TRADE_RETCODE_INVALID_STOPS (10016): Invalid stops in the request

MetaTrader 5 returns retcode 10016 when a stop loss or take profit is too close to the current price (inside SYMBOL_TRADE_STOPS_LEVEL), on the wrong side of the price, or has an invalid price step.

Official docs opened 2026-11-16. MT5 error 10016. Plain-English guide, not financial advice.

What the official docs say

MQL5 docs: "10016 TRADE_RETCODE_INVALID_STOPS - Invalid stops in the request". MQL5 article 2555: a buy is made at Ask, so TakeProfit - Bid >= STOPS_LEVEL and Bid - StopLoss >= STOPS_LEVEL; a sell is made at Bid, so Ask - TakeProfit >= STOPS_LEVEL and StopLoss - Ask >= STOPS_LEVEL. SYMBOL_TRADE_STOPS_LEVEL is in points.

Three common causes

  1. SL or TP is closer than SYMBOL_TRADE_STOPS_LEVEL points to the price (stops level 0 means no minimum is set).
  2. You measured the distance from the entry price, while a buy's stops are checked against Bid and a sell's against Ask.
  3. The SL or TP is not rounded to the symbol's tick size or digits.

How to fix it

  1. Read SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_POINT for the symbol.
  2. For a buy: StopLoss <= Bid - level x point and TakeProfit >= Bid + level x point. For a sell: StopLoss >= Ask + level x point and TakeProfit <= Ask - level x point.
  3. Push the stops out to the nearest valid price, or skip the trade.
  4. Round to SYMBOL_DIGITS and send again.

MQL5 example (runs as shown with sample numbers):

bool FixStops(const string sym, bool is_buy, double &sl, double &tp)
{
   long   lvl   = SymbolInfoInteger(sym, SYMBOL_TRADE_STOPS_LEVEL);
   double point = SymbolInfoDouble(sym, SYMBOL_POINT);
   double bid = SymbolInfoDouble(sym, SYMBOL_BID), ask = SymbolInfoDouble(sym, SYMBOL_ASK);
   double gap = lvl * point;
   int digits = (int)SymbolInfoInteger(sym, SYMBOL_DIGITS);
   if(is_buy)
   {
      if(sl > 0 && sl > bid - gap) sl = bid - gap;
      if(tp > 0 && tp < bid + gap) tp = bid + gap;
   }
   else
   {
      if(sl > 0 && sl < ask + gap) sl = ask + gap;
      if(tp > 0 && tp > ask - gap) tp = ask - gap;
   }
   if(sl > 0) sl = NormalizeDouble(sl, digits);
   if(tp > 0) tp = NormalizeDouble(tp, digits);
   return true;
}

What the official docs say

ItemOfficial wordingNumber in the docsSource and read date
SYMBOL_TRADE_STOPS_LEVELMinimal indention in points from the current close price to place Stop orders-Official docs, read 2026-11-16
SYMBOL_TRADE_FREEZE_LEVELDistance to freeze trade operations in points-Official docs, read 2026-11-16
SYMBOL_TRADE_TICK_SIZEMinimal price change-Official docs, read 2026-11-16

Check your numbers

Type the prices and the stops level from the symbol Specification.

Look up MT5 return codes and symbol properties by API: AIKIT (free 1,000 calls)

Disclosure: AIKIT is our own product. It returns sourced exchange and broker rules (with the official source and read date) and checks bot code against them. Facts and checks only, not advice.

Questions people ask

What does MT5 error 10016 mean?

Invalid stops: your stop loss or take profit breaks the symbol's minimum distance rule or is on the wrong side of the price.

Which price is the distance measured from?

For a buy, from Bid. For a sell, from Ask (MQL5 article 2555).

What if the stops level is zero?

Then the broker has set no minimum distance, but stops still must be on the right side of the price and rounded to the tick.

Sources

Exchange rules change; read the live values from the venue before you trade.

All error fixes. General information for education only. It is not financial advice, and trading can lose money.