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.
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
- SL or TP is closer than SYMBOL_TRADE_STOPS_LEVEL points to the price (stops level 0 means no minimum is set).
- You measured the distance from the entry price, while a buy's stops are checked against Bid and a sell's against Ask.
- The SL or TP is not rounded to the symbol's tick size or digits.
How to fix it
- Read SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_POINT for the symbol.
- 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.
- Push the stops out to the nearest valid price, or skip the trade.
- 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
| Item | Official wording | Number in the docs | Source and read date |
|---|---|---|---|
| SYMBOL_TRADE_STOPS_LEVEL | Minimal indention in points from the current close price to place Stop orders | - | Official docs, read 2026-11-16 |
| SYMBOL_TRADE_FREEZE_LEVEL | Distance to freeze trade operations in points | - | Official docs, read 2026-11-16 |
| SYMBOL_TRADE_TICK_SIZE | Minimal 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
- https://www.mql5.com/en/articles/2555 (read 2026-11-16)
- https://www.mql5.com/en/docs/constants/errorswarnings/enum_trade_return_codes (read 2026-11-16)
Exchange rules change; read the live values from the venue before you trade.
Related fixes
- TRADE_RETCODE_INVALID_VOLUME (10014): Invalid volume in the request (MetaTrader 5)
- TRADE_RETCODE_INVALID_FILL (10030): Invalid order filling type (MetaTrader 5)
- Filter failure: LOT_SIZE (Binance spot)
- Filter failure: NOTIONAL (Binance spot)
All error fixes. General information for education only. It is not financial advice, and trading can lose money.