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
- Read the minimum, maximum and step of the symbol the order is for, not of the chart symbol.
- Round the computed lot down to the step (never up: rounding up adds risk), then cap it at the maximum.
- If the result is below the minimum, skip the trade and log it instead of forcing the minimum lot.
- 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
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.
Related codes
- 10019Not Enough MoneyTRADE_RETCODE_NO_MONEYNot enough money: the free margin does not cover the order
- 10013Invalid RequestTRADE_RETCODE_INVALIDInvalid request: a field of the trade request is wrong or missing
EA Doctor rules that catch it
- HighCalculated lot not rounded to the volume stepA lot calculated from risk, balance or a multiplier is sent without rounding it to the symbol's volume step, which the server refuses with 10014.
- HighCalculated lot not checked against the minimum and maximumA calculated lot is sent without checking the symbol's minimum and maximum volume, so small accounts and large multipliers get 10014.
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.