Skip to content

Trade server return code

10014 TRADE_RETCODE_INVALID_VOLUME

Invalid volume: the lot breaks the symbol's minimum, maximum or step

What it means

The volume in the request is not a volume this symbol accepts. Every symbol has a minimum (SYMBOL_VOLUME_MIN, "Minimal volume for a deal"), a maximum (SYMBOL_VOLUME_MAX) and a step (SYMBOL_VOLUME_STEP, "Minimal volume change step for deal execution"); a lot must lie between the first two and be a whole number of steps.

Common causes

  • A risk-based lot (a percentage of the balance divided by the stop distance) sent without rounding to the step.
  • A lot below the minimum, often on small accounts, or above the maximum after a martingale multiplier.
  • Constants such as 0.01 or 100 hard-coded for one broker and used on a symbol with a different step or limits.
  • Closing part of a position with a volume that is not a multiple of the step.

A real scenario

A risk-based EA computes 0.1373 lots from 1 % of the balance and a 40-pip stop and sends it unchanged. The EURUSD step on the account is 0.01, so the server answers 10014 on every signal. The same EA had run on another account only because its settings used a fixed lot there.

How to fix it

  1. Read the minimum, maximum and step of the symbol the order is for, not of the chart symbol.
  2. Round the computed lot down to the step (never up: rounding up adds risk), then cap it at the maximum.
  3. If the result is below the minimum, skip the trade and log it instead of forcing the minimum lot.
  4. The same check is the first of the checks MetaQuotes lists for EAs published in the Market ("Invalid volumes in trade operations").

Fixed MQL5 code

MQL5
double NormalizeLots(const string symbol, double lots)
{
   double minLot = SymbolInfoDouble(symbol, SYMBOL_VOLUME_MIN);
   double maxLot = SymbolInfoDouble(symbol, SYMBOL_VOLUME_MAX);
   double step   = SymbolInfoDouble(symbol, SYMBOL_VOLUME_STEP);
   if(step <= 0.0)
      return 0.0;
   lots = MathFloor(lots / step + 1e-9) * step;     // round down to the step, never up
   if(lots < minLot)
      return 0.0;                                  // too small: skip the trade, do not force the minimum
   lots = MathMin(lots, maxLot);
   int digits = (int)MathMax(0.0, MathCeil(-MathLog10(step)));
   return NormalizeDouble(lots, digits);
}

A focused example for MetaTrader 5: adapt names, magic number and limits to your EA, and test it on a demo account first.

EA Doctor rules that catch it

Sources

Get your EA fixed

Still failing with 10014? Send us the EA and the journal lines: we find the cause in the code and fix it. Or check it yourself first with the EA Doctor.