MT5 order rejected with retcode 10030: the fill mode enum is not the symbol flag
Posted: Sat Oct 24, 2026 11:49 am
MT5 order rejected with retcode 10030: the fill mode enum is not the symbol flag
A common EA bug on MT5: OrderSend comes back with retcode 10030, invalid fill type. The cause is usually a mix up between two different numbering schemes.
The symbol property SYMBOL_FILLING_MODE returns a bitmask of what the symbol allows: FOK is flag 1 and IOC is flag 2. The trade request's type_filling field uses a different enum: ORDER_FILLING_FOK is 0, ORDER_FILLING_IOC is 1 and ORDER_FILLING_RETURN is 2. If you take the symbol flag and pass it straight into the request, a symbol that allows only IOC gives you a 2, which the request reads as RETURN, and the server rejects it.
The mapping, which is where it goes wrong: flag 1 (FOK allowed) corresponds to enum 0, and flag 2 (IOC allowed) corresponds to enum 1. So flag 2 looks exactly like enum 2, which is Return, and nothing in the compiler warns you.
If type_filling is left unset it's 0, which is FOK, and that gets rejected on symbols that only allow IOC.
Return is treated as always available, except that it isn't allowed in Market execution mode, which is what many ECN style accounts use.
A short version that picks the mode from the flags:
int fm = (int)SymbolInfoInteger(sym, SYMBOL_FILLING_MODE);
ENUM_ORDER_TYPE_FILLING f = ORDER_FILLING_RETURN;
if((fm & SYMBOL_FILLING_IOC) != 0) f = ORDER_FILLING_IOC;
else if((fm & SYMBOL_FILLING_FOK) != 0) f = ORDER_FILLING_FOK;
request.type_filling = f;
Do this per symbol, not once per account. Different symbols on the same account often allow different modes.
A common EA bug on MT5: OrderSend comes back with retcode 10030, invalid fill type. The cause is usually a mix up between two different numbering schemes.
The symbol property SYMBOL_FILLING_MODE returns a bitmask of what the symbol allows: FOK is flag 1 and IOC is flag 2. The trade request's type_filling field uses a different enum: ORDER_FILLING_FOK is 0, ORDER_FILLING_IOC is 1 and ORDER_FILLING_RETURN is 2. If you take the symbol flag and pass it straight into the request, a symbol that allows only IOC gives you a 2, which the request reads as RETURN, and the server rejects it.
The mapping, which is where it goes wrong: flag 1 (FOK allowed) corresponds to enum 0, and flag 2 (IOC allowed) corresponds to enum 1. So flag 2 looks exactly like enum 2, which is Return, and nothing in the compiler warns you.
If type_filling is left unset it's 0, which is FOK, and that gets rejected on symbols that only allow IOC.
Return is treated as always available, except that it isn't allowed in Market execution mode, which is what many ECN style accounts use.
A short version that picks the mode from the flags:
int fm = (int)SymbolInfoInteger(sym, SYMBOL_FILLING_MODE);
ENUM_ORDER_TYPE_FILLING f = ORDER_FILLING_RETURN;
if((fm & SYMBOL_FILLING_IOC) != 0) f = ORDER_FILLING_IOC;
else if((fm & SYMBOL_FILLING_FOK) != 0) f = ORDER_FILLING_FOK;
request.type_filling = f;
Do this per symbol, not once per account. Different symbols on the same account often allow different modes.