MT5 error 10014: Invalid volume (TRADE_RETCODE_INVALID_VOLUME)
The lot size is below the minimum, above the maximum or off the volume step. Nothing was executed; round the volume and resend.
What it means
You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.
Every symbol has a smallest volume, a largest volume and a step. A volume that breaks any of the three is refused with 10014.
Cent and micro accounts often have different limits from standard accounts at the same broker, so a size that works on one account can fail on another.
Common causes
- A volume below
volume_min, often from a risk formula that returns a tiny number. - A volume above
volume_max. - A volume that isn't a whole multiple of
volume_step, such as 0.015 when the step is 0.01. - Floating point leftovers like 0.30000000000000004.
How to fix it
- Read
volume_min,volume_maxandvolume_stepfromsymbol_info()for that exact symbol name. - Round down to the step, clamp to the limits, then round to a sane number of decimals.
- Skip the trade if the rounded size falls below the minimum, rather than forcing the minimum.
Example in Python:
import math
import MetaTrader5 as mt5
def valid_volume(symbol, raw):
s = mt5.symbol_info(symbol)
steps = math.floor(raw / s.volume_step + 1e-9)
vol = round(steps * s.volume_step, 8)
if vol < s.volume_min:
return None # too small to trade: skip it
return min(vol, s.volume_max)
print(valid_volume("EURUSD", 0.237)) # 0.23 when the step is 0.01 Is it safe to retry?
Yes, once the volume fits the symbol's rules.
Could the order have executed?
No. The order was refused.
How Tickwire handles it
Tickwire checks the volume against the symbol's minimum, maximum and step before sending. A bad volume is refused with 10014 and nothing is sent.
minVolume and volumeStep are in the symbol specification. See broker quirks.
MT4 error 131 comes back as 10014.
Related codes
- MT5 error 10019: Not enough money (TRADE_RETCODE_NO_MONEY)
- MT5 error 10038: Close volume exceeds the position (TRADE_RETCODE_INVALID_CLOSE_VOLUME)
- MT5 error 10034: Volume limit for the symbol reached (TRADE_RETCODE_LIMIT_VOLUME)
- MT4 error 131: Invalid trade volume (ERR_INVALID_TRADE_VOLUME)
Related MT5 Python functions
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.