TRADE_RETCODE_INVALID_FILL (10030): Invalid order filling type
MetaTrader 5 returns retcode 10030 when the type_filling you put in the order request is not allowed for that symbol and its execution mode. The fix is to ask the symbol which filling modes it supports and pick one of those.
What the official docs say
MQL5 docs: "10030 TRADE_RETCODE_INVALID_FILL - Invalid order filling type". Order properties docs: SYMBOL_FILLING_MODE gives the allowed filling flags; ORDER_FILLING_RETURN is enabled at all times except in Market execution; FOK and IOC depend on the symbol setting in Market and Exchange execution.
Three common causes
- The EA hard-codes ORDER_FILLING_FOK but the broker only allows IOC (or the reverse).
- ORDER_FILLING_RETURN was used on a symbol in Market execution mode, where it is disabled.
- The same EA runs on several brokers; each broker sets filling flags differently.
How to fix it
- Read SYMBOL_FILLING_MODE and SYMBOL_TRADE_EXEMODE with SymbolInfoInteger.
- Choose FOK if flag 1 is set, else IOC if flag 2 is set, else RETURN (not in Market execution).
- Set request.type_filling to that value before OrderSend.
- Pending orders should use ORDER_FILLING_RETURN, as the MQL5 docs state.
MQL5 example (runs as shown with sample numbers):
ENUM_ORDER_TYPE_FILLING PickFilling(const string sym)
{
long modes = SymbolInfoInteger(sym, SYMBOL_FILLING_MODE);
long exe = SymbolInfoInteger(sym, SYMBOL_TRADE_EXEMODE);
if((modes & SYMBOL_FILLING_FOK) != 0) return ORDER_FILLING_FOK;
if((modes & SYMBOL_FILLING_IOC) != 0) return ORDER_FILLING_IOC;
if(exe != SYMBOL_TRADE_EXECUTION_MARKET) return ORDER_FILLING_RETURN;
return ORDER_FILLING_IOC; // last resort
}
What the official docs say
| Item | Official wording | Number in the docs | Source and read date |
|---|---|---|---|
| ORDER_FILLING_FOK | Fill or Kill: execute the full volume or not at all | - | Official docs, read 2026-11-16 |
| ORDER_FILLING_IOC | Immediate or Cancel: fill what is available, cancel the rest | - | Official docs, read 2026-11-16 |
| ORDER_FILLING_RETURN | Return: a partly filled order keeps working; not allowed in Market execution | - | Official docs, read 2026-11-16 |
Check your numbers
Type the SYMBOL_FILLING_MODE value and pick the execution mode.
Look up MT5 return codes and symbol properties by API: AIKIT (free 1,000 calls)
Disclosure: AIKIT is our own product. It returns sourced exchange and broker rules (with the official source and read date) and checks bot code against them. Facts and checks only, not advice.
Questions people ask
What does MT5 error 10030 mean?
The filling type in your order request is not supported for this symbol.
Which filling mode should I use?
Read SYMBOL_FILLING_MODE and use one of the allowed flags. Do not hard-code one for every broker.
Is it the same on a demo and a live account?
Not always. Brokers can set different modes per account type, so test on the account you will trade.
Sources
- https://www.mql5.com/en/docs/constants/errorswarnings/enum_trade_return_codes (read 2026-11-16)
- https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties (read 2026-11-16)
Exchange rules change; read the live values from the venue before you trade.
Related fixes
- TRADE_RETCODE_INVALID_VOLUME (10014): Invalid volume in the request (MetaTrader 5)
- TRADE_RETCODE_INVALID_STOPS (10016): Invalid stops in the request (MetaTrader 5)
- Filter failure: LOT_SIZE (Binance spot)
- Filter failure: NOTIONAL (Binance spot)
All error fixes. General information for education only. It is not financial advice, and trading can lose money.