Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
If your MQL5 EA logs TRADE_RETCODE_INVALID_VOLUME, which is retcode 10014, the usual cause is a lot size that doesn't fit the symbol's volume settings. Three values matter:
SYMBOL_VOLUME_MIN, the smallest allowed size, often 0.01.
SYMBOL_VOLUME_MAX, the largest allowed size per order.
SYMBOL_VOLUME_STEP, the increment, often 0.01 but sometimes 0.1 or 1 on metals, indices or certain accounts.
A computed size like 0.6249999 from a risk formula won't pass. Neither will 0.625 if the step is 0.01.
Here's the logic I use:
step = SymbolInfoDouble(sym, SYMBOL_VOLUME_STEP)
lots = MathFloor(raw / step) * step
lots = NormalizeDouble(lots, digits for the step)
if lots < min, skip the trade
if lots > max, cap at max or split into several orders
The digits for the step come from the step itself: 0.01 needs 2, 0.1 needs 1, 1 needs 0. Floating point means MathFloor(0.62 / 0.01) can occasionally come out as 61 instead of 62, so I add a tiny epsilon, like 1e-9, before flooring.
Worked case: raw size 0.6249, step 0.01. 0.6249 divided by 0.01 is 62.49, floored to 62, times 0.01 is 0.62. Normalized to two digits it's 0.62, and the order passes.
The max check matters more than people think. A large account can produce a size above the symbol max on a tight stop, and the whole order fails.
Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
-
FXS HongKong Scalper
- Posts: 407
- Joined: Sat Oct 24, 2026 10:15 pm
Re: Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
Clear explanation. I would also check the volume against SYMBOL_VOLUME_LIMIT, which is the maximum total volume allowed in one direction for the symbol. Some brokers set it on certain accounts, and orders fail even though each order is within the maximum size. For EAs that scale in, adding up the open volume plus the new order before sending is a good check. And as always, logging the size before and after rounding makes it easier to find the cause when an order fails.
FXS Official Team | Hong Kong Session Desk
Re: Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
Some brokers also have a total volume limit per symbol, SYMBOL_VOLUME_LIMIT, which caps the combined size of open positions and pending orders in one direction. It's usually zero, meaning no limit, but on certain accounts it's set. If an EA scales into a position with several entries, the later ones can be rejected even though each one is valid alone. Reading that value once on start and logging it saves a confusing afternoon of rejected orders. It also differs by broker, so check it on every account you use. Most of the time it's zero.
It’s Fairman 
Re: Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
On MT4 the error you'd see is 131, ERR_INVALID_TRADE_VOLUME, and the same rounding logic applies with MarketInfo MODE_MINLOT, MODE_MAXLOT and MODE_LOTSTEP. I'd still write the volume function once and reuse it in every EA rather than having slightly different versions. A shared include file with sizing, rounding and checks means a fix in one place fixes everything. The MQL4 and MQL5 versions can share most of the code if you wrap the symbol info calls in a small helper. That way the rounding and limit checks are written once, and you only swap the function that reads the volume settings. Fewer copies means fewer copies to fix.
It’s Fairman 
Re: Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
Logging is the other half. When an order fails, log the raw size, the rounded size, min, max and step, plus the retcode and the comment from the trade result. Most volume problems become obvious once you see those numbers side by side. Without them, you're left guessing whether it was the volume, the stop level or the margin. I write one line per failed order to a separate file so it doesn't get lost in the normal journal. A failed order log of this kind also helps when you talk to the broker's support team, because they can see exactly what was sent.
It’s Fairman 
Re: Rounding to SYMBOL_VOLUME_STEP so orders stop failing with 10014
Prop firm accounts sometimes have different volume settings from the same broker's retail accounts, including a smaller max per order. If you move an EA from a personal account to a funded one, print the volume settings on start and check them by eye the first time. An EA that worked fine on one account can fail on every order on another simply because the max is lower or the step is different. The same applies to the stop level and freeze level, which can also differ between account types and cause rejections that look like sizing problems.
It’s Fairman 