Your strategy as an MT5 bot · Daily-loss lock built incontact@stratcorealpha.com · DE
All trading software errors

MT5 · code and request checks

MT5 error 10016: check both stop prices

Your SELL can fail with error 10016 even with an unchanged Stop Loss: correcting Take Profit made my check pass. My EURUSD check changed from 10016 to 0, Done, after TP moved below Ask. No order was sent.

Actual HolaPrime MT5 EURUSD screenshot: SELL TP above Ask rejected, TP below Ask accepted by the direction check, SL unchanged and zero orders sent.

Arnold Holm · 2026-10-05

What the error means

I check both protection prices before moving Stop Loss farther away. Open one failed SELL request and compare its Take Profit with Ask, then check the Stop Loss separately. I built one SELL request around the quote available in the isolated HolaPrime MT5 chart. I put Stop Loss above Ask and deliberately put Take Profit at that same price. The price grid and stop-distance reads were recorded beside the request. The first OrderCheck returned Invalid stops, code 10016. My small direction check also rejected the TP side. I changed only TP, moving it below Ask while keeping SL and the requested volume unchanged. The final fresh run returned Done, code 0, and the direction check accepted the pair. An earlier run accepted the corrected direction but returned Common error from OrderCheck; that earlier log is retained with the proof rather than treated as a successful request check. You can therefore separate two questions: are both protection prices on the right sides, and did the complete request pass the current check? The script called OrderCheck and never OrderSend. Its screenshot shows the actual request prices, not a picture of a customer trade. 10016 is TRADE_RETCODE_INVALID_STOPS: the server rejected stops in the request. It is a trade-server retcode, not the terminal's GetLastError number. An EA is a program that applies your rules in MetaTrader. Read the actual request and server comment before deciding which part failed.

Three code paths to check

  1. 1. One protective price is on the wrong side

    For a BUY position, SL is below current Bid and TP is above it. For a SELL position, SL is above current Ask and TP is below it. Check both nonzero levels. A valid SL does not excuse a wrong-side TP. Pending entry prices have their own order-type constraints, so do not apply a market-position check blindly to every request.

  2. 2. The distance was checked against the wrong quote or unit

    Read SYMBOL_TRADE_STOPS_LEVEL on the actual symbol and convert its points using SYMBOL_POINT, not a hard-coded pip multiplier. Compare protection on the correct closing side: Bid for BUY, Ask for SELL. Capture a fresh tick beside the request; a changing spread can invalidate a distance that looked sufficient on an earlier quote. Zero reported stop distance does not validate the other request fields.

  3. 3. Price grid or modification state was omitted

    SYMBOL_DIGITS controls decimal display; SYMBOL_TRADE_TICK_SIZE controls the price increment. Decimal rounding alone need not put a stop on that grid. For a modification, also inspect SYMBOL_TRADE_FREEZE_LEVEL and reselect the intended position ticket. A frozen operation may have its own server retcode. Keep stop distance, freeze restrictions and position existence as separate checks rather than calling every rejection 10016.

Own pattern: inspect the complete request without placing a trade

Call this with the fully populated request from your authorised code. The function records quote time, request type, target ticket, both protection prices and the symbol's constraints. It calls OrderCheck but never OrderSend, widens a stop, removes protection or retries. Its true return means request details were collected. For TRADE_ACTION_SLTP, inspect the selected position's direction; request.type by itself is not the position's direction.

bool InspectStopRequest(const MqlTradeRequest &request)
{
   MqlTick quote = {};
   long stops = 0, freeze = 0, digits = 0;
   double point = 0.0, tick_size = 0.0;
   if(request.symbol == "" ||
      !SymbolInfoTick(request.symbol, quote) ||
      !SymbolInfoInteger(request.symbol, SYMBOL_TRADE_STOPS_LEVEL, stops) ||
      !SymbolInfoInteger(request.symbol, SYMBOL_TRADE_FREEZE_LEVEL, freeze) ||
      !SymbolInfoInteger(request.symbol, SYMBOL_DIGITS, digits) ||
      !SymbolInfoDouble(request.symbol, SYMBOL_POINT, point) ||
      !SymbolInfoDouble(request.symbol, SYMBOL_TRADE_TICK_SIZE, tick_size))
      return false;

   PrintFormat("symbol=%s action=%d type=%d position=%I64u",
               request.symbol, (int)request.action,
               (int)request.type, request.position);
   Print("quote_msc=", quote.time_msc,
         " Bid=", DoubleToString(quote.bid, (int)digits),
         " Ask=", DoubleToString(quote.ask, (int)digits),
         " price=", DoubleToString(request.price, (int)digits),
         " SL=", DoubleToString(request.sl, (int)digits),
         " TP=", DoubleToString(request.tp, (int)digits));
   Print("stops_points=", stops, " freeze_points=", freeze,
         " point=", DoubleToString(point, 10),
         " tick_size=", DoubleToString(tick_size, 10));

   MqlTradeRequest candidate = request;
   MqlTradeCheckResult check = {};
   ResetLastError();
   bool basic = OrderCheck(candidate, check);
   int terminal_error = GetLastError();
   PrintFormat("basic_check=%s terminal_error=%d check_retcode=%u comment=%s",
               basic ? "true" : "false", terminal_error,
               check.retcode, check.comment);
   return true; // diagnostic collected, NOT permission to trade
}

bool SellProtectionSide(const MqlTradeRequest &r,const MqlTick &q)
{
   return r.type==ORDER_TYPE_SELL && r.sl>q.ask && r.tp>0 && r.tp<q.ask;
}

This read-only EURUSD H1 script checks the shown request or signal path; your full EA still needs its own inputs, account checks and execution log.

How you know it is fixed

When it should continue: correct direction and permitted price grid

On the intended demo symbol, record a fresh quote and both nonzero protective prices on the correct sides, outside the stated stop distance and on the tick grid. Inspect OrderCheck fields. Any separately approved submission must also show the server retcode and the resulting position; a true function return alone is insufficient.

When it should stop: SELL with TP above current Ask

Keep the wrong-side TP visible in the sample even if SL is far enough away. The preflight rejects that case without sending, retrying or changing protection. This recreates the direction mistake in the linked public question, not a claim to have run that user's source.

Another case: quote changes or a modification is frozen

Refresh the tick and inspect stop distance, tick grid, freeze restrictions and the selected position again. Record the exact rejection code rather than assuming 10016. Missing symbol properties make the checking return false. No automatic stop widening and no repeated order request are accepted as a repair.

I can fix it for you

If the three agreed tests don't pass, you get your money back. I fix one authorised, reproducible MT4 or MT5 defect in readable source up to 500 lines. The fixed price is 49 USD. Delivery is within 48 hours after source review and funding.

Free demo of your fixCheck my EA locally

Request a free demo of your fix

I use your email to reply about this fix. Privacy policy

Common questions

Does 10016 mean my stop-loss is always too close?

No. Check direction and distance for both SL and TP, plus the pending entry price where applicable. The linked SELL question had a take-profit above Ask. Moving only the stop-loss farther away would not correct that request.

Will NormalizeDouble fix invalid stops?

It controls decimal precision, not every symbol's permitted price increment or stop distance. Read tick size, points and the current quote separately. Correct rounding still does not guarantee that the server accepts a complete request.

Can I remove stops and add them after entry?

That changes the protection path and creates an unprotected interval. It is not a general checking fix. Preserve the agreed risk rule, record the rejected request and test an explicit permitted workflow on demo before any separately authorised use.

Sources and limits

These public questions explain the error; use your own EA log to check whether the same cause applies.

Trading risk disclosure

Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical performance disclosure

Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. There are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical results are generally prepared with the benefit of hindsight, do not involve financial risk, and cannot completely account for the impact of financial risk in actual trading. Market conditions, the ability to withstand losses, and adherence to a trading program can all materially affect actual results.

NinjaTrader trademark disclosure

NinjaTrader® is a registered trademark of NinjaTrader Group, LLC. No NinjaTrader company has any affiliation with the owner, developer, or provider of the products or services described herein, or any interest, ownership or otherwise, in any such product or service, or endorses, recommends or approves any such product or service.

Testimonials, when shown, may not represent the experience of other clients and are not a guarantee of future performance or success. Virtual-currency trading carries additional risks. See the CFTC customer advisories. Read the full financial risk disclaimer.