MT5 Invalid Volume: build a lot-step preflight matrix before your EA sends an order

Diagnose MT5 volume rejections with a log-only matrix for minimum lot, maximum lot, volume step, aggregate limit and missing symbol data.

BamaUp Editorial ·
A millimetre ruler illustrating an MT5 volume-step check, not a trading result or performance chart
Ruler.svg by cyberscooty, from Openclipart via Wikimedia Commons, CC0 1.0, unmodified. Conceptual illustration.

Treat the return code as evidence, not a diagnosis by anecdote

MetaTrader 5 identifies server return code 10014 as TRADE_RETCODE_INVALID_VOLUME, meaning that the request contains an invalid volume [5]. That evidence is narrower than a claim that the account lacks funds, the strategy chose the wrong direction or the broker is unreliable. Preserve the requested volume, symbol, order type, timestamp, symbol properties and complete result code before changing any EA parameter.

Keep related failures separate. The official table assigns 10019 to insufficient money and 10034 to a symbol's aggregate volume limit being reached [5]. A journal entry that only says 'order failed' collapses distinct test cases. It can lead a developer to change position sizing when the real issue is available margin, a directional volume cap or another request field.

Query four volume properties from the actual symbol

SYMBOL_VOLUME_MIN, SYMBOL_VOLUME_MAX and SYMBOL_VOLUME_STEP describe the minimum deal volume, maximum deal volume and smallest permitted volume increment [1]. SYMBOL_VOLUME_LIMIT is a different property: it caps the aggregate open-position and pending-order volume in one direction for the symbol [1, 3]. These properties are doubles retrieved with SymbolInfoDouble [2].

Do not copy the values from another broker, account or instrument. When SymbolInfoDouble fails, capture GetLastError rather than substituting zero or a cached assumption. The reference distinguishes an unknown symbol from a symbol that is not selected in Market Watch [2]. Missing properties should therefore produce an explicit failed precondition and block the request from progressing through the EA's pipeline.

Use invented arithmetic to expose off-grid volumes

Consider an explicitly hypothetical symbol with a 0.10-lot minimum, a 5.00-lot maximum and a 0.05-lot step. A request for 0.13 lots is inside the numeric range but not on the permitted grid: its difference from the 0.10 base is 0.03, which is not an integer multiple of 0.05. The adjacent allowed candidates are 0.10 and 0.15 in this invented specification.

An EA should not silently round 0.13 upward merely to remove an error. Rounding up increases exposure, required margin and potential loss; rounding down can also change the strategy's sizing intention. A safer preflight either rejects the off-grid value with a precise reason or applies an explicitly configured and separately tested policy. Decimal display digits alone do not define the volume step.

Build a log-only boundary matrix

Keep AutoTrading disabled and exercise only the local validation function. For the hypothetical specification, include 0.05, 0.10, 0.13, 0.15, 5.00 and 5.05 lots. Write the expected outcome first: below minimum, exactly minimum, off-grid, on-grid, exactly maximum and above maximum. Add a seventh case in which one required symbol property cannot be read.

Each row should retain the raw input, min, max, step, computed grid index, allow-or-reject decision and reason. Use a small tolerance appropriate for floating-point comparison, but do not make it broad enough to convert a genuinely invalid request into an allowed one. Test the policy with non-power-of-ten steps as well; formatting a number to a familiar decimal count is not a substitute for checking the actual grid.

OrderCheck is another gate, not an execution promise

After local checks pass, and only inside a separately approved demo procedure, OrderCheck can examine request parameters and available funds through MqlTradeCheckResult [4]. Its documentation warns that a successful basic check does not guarantee the requested trade operation will execute. The result structure, later server response and final deal state remain distinct pieces of evidence [4].

This exercise does not call OrderSend. Its purpose is to prove how the volume filter handles valid inputs, invalid boundaries and unavailable metadata before any trading request exists. A volume that satisfies min, max and step can still conflict with an aggregate directional limit, margin, market state, order type or another broker rule. Do not collapse all of those stages into one green status.

Evidence to request before buying or auditing an EA

Ask for the program version, tested symbol and account environment, all four volume properties, the raw sizing output, the rounding policy and the full server retcode. An equity curve or a screenshot of one successful trade does not show how the robot behaves when an instrument uses a different increment. An EX5 file may support observable behavior tests, but a full logic audit requires MQ5 source and its dependencies.

Your next practical action is to run the seven-row matrix in log-only mode on a demo symbol and retain rejects and unknown states as carefully as passes. If an existing EA repeatedly returns 10014, you can explore BamaUp's EA audit after confirming scope and pricing. This guide is engineering education, not a signal, a live test result, a recommended position size or a guarantee of returns.

Article references

1. Official MQL5 Reference: Symbol Properties2. Official MQL5 Reference: SymbolInfoDouble3. Official MQL5 Book: Permitted Volumes of Trading Operations4. Official MQL5 Reference: OrderCheck5. Official MQL5 Reference: Trade Server Return Codes

Hypothetical examples are not BamaUp trading performance.

Support