
MT5 Invalid Volume (Error 10014): Lot Step, Minimum and Maximum
"Invalid volume" in MT5 is return code 10014, TRADE_RETCODE_INVALID_VOLUME, which MetaQuotes describes as "Invalid volume in the request." The broker refused the lot size rather than the trade itself. Every symbol has a minimum size, a maximum size and a step between allowed sizes, and a volume that breaks any one of the three is rejected.
Those limits are set per symbol and often per account type as well, so a size that works on one instrument can fail on the next. This guide shows how to read the limits and keep an automated strategy inside them.
The three volume limits on every MT5 symbol#
Right-click the symbol in Market Watch and open Specification, where three fields decide which volumes the broker will accept:
| Field | MQL5 property | Example | Effect |
|---|---|---|---|
| Minimal volume | SYMBOL_VOLUME_MIN | 0.01 | Smaller sizes are refused |
| Maximal volume | SYMBOL_VOLUME_MAX | 100 | Larger sizes are refused in a single order |
| Volume step | SYMBOL_VOLUME_STEP | 0.01 | The size must be a whole number of steps |
With a step of 0.01, a size of 0.15 is valid and 0.155 is not, while a step of 0.1, which some brokers use on indices and metals, makes 0.15 invalid too. With a minimum of 0.1, the 0.01 test size many traders send out of habit is refused outright.
How to round lot sizes correctly#
A calculated size almost never lands exactly on a step, so it has to be rounded before it is sent, and the safe direction is down to the nearest step, followed by a check against the minimum and maximum. Rounding up can push the risk above what the strategy intended without any warning, which matters most on symbols with a large step.
You also need to round to the step's own precision. Floating-point arithmetic can turn 0.15 into 0.15000000000000002, which some servers reject as off-step even though it looks correct on screen. EAs usually normalise the result with NormalizeDouble, using the number of decimals in the step.
Rounding the lot size in Pine Script#
If your TradingView strategy calculates the lot size itself, you can apply the same rule before the size goes into the alert. Pine Script cannot read your broker's volume limits, so enter them as inputs copied from the symbol's specification, then round down to the step and format the result with the step's number of decimals:
//@version=6
strategy("Risk-sized entries", overlay = true)
riskPct = input.float(1.0, "Risk per trade (%)")
slPips = input.float(20.0, "Stop loss (pips)")
pipValue = input.float(10.0, "Pip value of 1 lot, in account currency")
volStep = input.float(0.01, "Broker volume step")
volMin = input.float(0.01, "Broker minimum volume")
volMax = input.float(100.0, "Broker maximum volume")
rawLots = strategy.equity * riskPct / 100 / (slPips * pipValue)
// Round DOWN to the step. The tiny epsilon stops 0.3 / 0.1 = 2.9999999 from losing a step.
lots = math.min(math.floor(rawLots / volStep + 1e-9) * volStep, volMax)
lotsText = str.tostring(lots, "#.##") // use "#.#" for a 0.1 step, "#" for a step of 1
if ta.crossover(ta.sma(close, 20), ta.sma(close, 50)) and lots >= volMin
strategy.entry("Long", strategy.long, alert_message = "LICENSE,buy,EURUSD,size_lots=" + lotsText + ",sl_pips=" + str.tostring(slPips))
The alert's Message field then needs {{strategy.order.alert_message}} so the calculated text is what gets sent, as the order-fill alerts guide shows, and LICENSE has to be replaced with your license key. Two limits apply to this approach. strategy.equity is TradingView's simulated equity rather than your real account balance, and the inputs have to be updated by hand whenever you trade a symbol or broker with different limits.
With PineHook you can skip the calculation in Pine entirely. Sending size_pct=1 with a stop loss lets the EA size the trade from your real balance and the broker's own tick value, and it then rounds and checks the result against the symbol's limits, as the section below explains.
Why the lot size is wrong in the first place#
Contract sizes differ between symbols and brokers#
One lot means different things on different instruments. On forex it is usually 100,000 units of the base currency, while on gold it is often 100 ounces but sometimes 1, an index CFD can use 1, 10 or 100 contracts, and a crypto CFD can use a single coin. A strategy that sends 1 lot because that was right on EURUSD can therefore be wildly oversized, or below the minimum, on another symbol, so check Contract size in the same specification window before you reuse a size.
Cent and micro accounts use their own units#
Cent accounts and some micro account types quote volume in their own units, with different minimums and steps, so a size copied from a standard account rarely fits without adjustment.
Partial closes that fall below the minimum#
Closing a percentage of a small position can produce a volume below the minimum. Closing 30% of a 0.05-lot position asks for 0.015, which rounds down to a valid 0.01 on a 0.01 step, but on a symbol with a 0.1 minimum, closing part of a 0.1 position is impossible, which is why multi-target ladders that close a share at each level run into this on small positions.
The total volume limit on a symbol (10034)#
Some brokers cap the total volume you can hold on one symbol across all positions and pending orders. That limit is SYMBOL_VOLUME_LIMIT, and breaking it returns 10034, "The volume of orders and positions for the symbol has reached the limit," rather than 10014, typically when a strategy keeps adding to a position.
Closing more than you hold (10038)#
A close request larger than the open position returns 10038, "A close volume exceeds the current position volume," which usually means the position was already partly closed by a target, a manual close or another EA before the close arrived.
How PineHook fits every lot size to the broker#
When the lot size comes from a TradingView alert, the alert usually knows nothing about the broker's limits, so the receiving EA has to fit the size to them, and this is one of the problems PineHook handles for you. The PineHook EA rounds every size down to the symbol's volume step and caps it at the maximum before sending, so an off-step size never reaches the broker, and when the result falls below the minimum it refuses the order with a message that spells out both numbers:
size_lots (0.0050) below symbol minimum (0.0100) after step normalization
Risk-based sizing that works out below the minimum is refused with a message naming the sizing method, which tells you at once whether the alert had a typo or the calculated risk was simply too small for the symbol. On a ladder, a target whose share of a small position rounds below the minimum is skipped with a calc_lots=0 warning rather than failing the whole position, and every one of these explanations appears on the alert's Signal Logs row.
If one alert drives several accounts or brokers, lot size conversion adjusts the size for each destination and the trade copier applies its own multiplier on top, so check both first when only one destination fails. You can create a PineHook account without payment details and send a few test sizes to a demo account to see how they are adjusted.
Lot size conversion on a license. The broker-wide factor of 1 leaves sizes unchanged, and the EURUSD exception turns a strategy's 100,000 units into 1 lot.FAQ#
Why does my EA trade 0.01 lots on one symbol and fail on another?
The second symbol has a larger minimum or step, which is common on indices, metals and crypto CFDs where 0.1 or 1 is the minimum, so compare the two specifications.
Should an EA round small lot sizes up to the minimum?
It can, but that means trading more than the strategy asked for, and with a 0.1 minimum and a calculated 0.02, rounding up takes five times the intended risk. Refusing the order is the safer default, leaving the decision with you.
Is MT5 invalid volume the same as error 131?
131 is MT4's invalid trade volume code, and MT5 reports the same refusal as 10014.
Related guides#
- MT5 error 10019 not enough money
- MT5 error 4756 trade request sending failed
- Lot size conversion
- Invalid volume in the trade errors reference
MetaTrader is a trademark of MetaQuotes, and PineHook is an independent product that is not affiliated with, endorsed by, or sponsored by MetaQuotes. Leveraged trading carries a high risk of loss, so test any automated setup on a demo account before you trade it live.
