MT5 error 10030: Invalid order filling type (TRADE_RETCODE_INVALID_FILL)
The filling mode (FOK, IOC or Return) isn't allowed for this symbol at this broker. Nothing was executed; pick an allowed mode.
What it means
You see this code in the retcode of a trade result, from OrderSend() in MQL5 or order_send() in Python.
Every MT5 order has a filling policy: Fill or Kill, Immediate or Cancel, or Return. Brokers allow only some of them per symbol, and 10030 means yours isn't one of them.
It is one of the most common errors when code moves from one broker to another, because the allowed modes differ.
Common causes
- A hard coded
ORDER_FILLING_FOKon a symbol that only allows IOC, or the other way round. - No
type_fillingat all, so the default is used and the broker doesn't accept it. - Code written for one broker and run at another.
How to fix it
- Read
symbol_info(name).filling_mode. Bit 1 means FOK is allowed and bit 2 means IOC is allowed. - Choose a mode from those bits for each order.
- A common pattern: try FOK, then IOC, and use Return when neither bit is set.
Example in Python:
import MetaTrader5 as mt5
def filling_for(symbol):
modes = mt5.symbol_info(symbol).filling_mode
if modes & 1: # FOK allowed
return mt5.ORDER_FILLING_FOK
if modes & 2: # IOC allowed
return mt5.ORDER_FILLING_IOC
return mt5.ORDER_FILLING_RETURN
request["type_filling"] = filling_for(request["symbol"])
print(mt5.order_check(request).retcode) # 0 means the request looks fine Is it safe to retry?
Yes, with a different filling mode. The first request was refused.
Could the order have executed?
No. The order was refused because of its filling mode.
How Tickwire handles it
Tickwire chooses from the symbol's allowed modes and checks the request with the terminal before sending. If the broker still answers 10030, it tries the next mode.
You can set your own order of preference with fillingModes. The default is FOK, IOC, Return for market orders and Return, FOK, IOC for pending orders. See broker quirks.
MT4 has no filling modes, so this code doesn't occur there.
Related codes
- MT5 return code 10010: Only part of the request was completed (TRADE_RETCODE_DONE_PARTIAL)
- MT5 error 10013: Invalid request (TRADE_RETCODE_INVALID)
- MT5 error 10035: Incorrect or prohibited order type (TRADE_RETCODE_INVALID_ORDER)
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.