# MT5 Execution Modes (Instant/Market/Exchange) & IOC/FOK

> Master MetaTrader 5 trade execution modes (Instant, Request, Market, Exchange) and order filling policies (FOK, IOC, Return) for MQL5 EAs and bridges.

Canonical: https://terminalledgerdesk.com/reports/mt5-execution-modes-instant-request-market-exchange-fill-policies
Last updated: 2026-11-14T20:06:08.600Z

**Publication:** Terminal Ledger Desk
**Category:** Mt5 Ctrader Bridge Dealer Architecture
**Published:** 2026-11-13T23:10:25.915Z
**Author:** Marcus Thorne, CQF (Certificate in Quantitative Finance (CQF), Low-Latency FIX & Matching Engine Architect)
**Reviewer:** Not recorded

## Answer-first summary

Hardcoding ORDER_FILLING_FOK inside an MQL5 Expert Advisor causes instant 10030 (Unsupported Filling Mode) rejections when deployed on an IOC/Return ECN broker—requiring bitmask inspection of SYMBOL_FILLING_MODE.

## Key takeaways

- Inspect SYMBOL_FILLING_MODE bitmasks dynamically in every MQL5 EA (preferring IOC on ECN bridges, FOK second, Return third) to eliminate Retcode 10030 rejections.
- Instant Execution requotes >68–90% of orders during macro volatility because server ticks drift outside tight client deviation bands during WAN transit.
- Market Execution ignores client price/deviation fields on market orders, routing straight through C++ bridges to fill at real-time multi-LP VWAP with zero requotes.
- Track fills via OnTradeTransaction keyed on DEAL_ORDER rather than assuming a 1-to-1 OrderSend-to-Deal mapping under IOC/Return partial-fill policies.

## Related financial entities

- **Financial Information eXchange (FIX) Protocol** (FIX-4.4) — product: Electronic communications protocol initiated in 1992 for international real-time exchange of securities transaction and market data information.
- **Institutional Liquidity Aggregation Bridge Engine** (BRIDGE-SYS) — product: High-performance middle-office routing software connecting retail trading servers (MT4/MT5/cTrader) to multi-bank Tier-1 liquidity providers.
- **MetaTrader 5 Multi-Server Cluster Architecture** (MT5-CORE) — product: Enterprise 64-bit distributed client-server architecture developed by MetaQuotes Software supporting multi-asset netting and hedging execution models.

## Analysis

Why does an MQL5 Expert Advisor that executes flawlessly on Demo Server A suddenly reject 100% of live orders on Institutional ECN Broker B with **`TRADE_RETCODE_INVALID_FILL (10030)`** or **`TRADE_RETCODE_REQUOTE (10004)`**? Unlike MT4 simplified order ticket, the [MetaTrader 5 Server Cluster](/engines/metatrader-5-server-cluster) implements a rigorous **4 × 3 institutional execution matrix**: **Four Symbol Execution Modes (`Instant`, `Request`, `Market`, `Exchange`)** crossed with **Three Order Filling Policies (`FOK`, `IOC`, `Return`)** mapped directly to upstream [FIX 4.4 `TimeInForce (59)`](/engines/fix-protocol-standard) semantics!

## The Four MT5 Symbol Execution Modes (`SYMBOL_TRADE_EXEMODE`)

Every symbol group configured by a broker administrator on [MT5 Terminal](/platforms/mt5-terminal-2) runs under exactly one of four `ENUM_SYMBOL_TRADE_EXECUTION` state machines:

1. **`SYMBOL_TRADE_EXECUTION_INSTANT` (`Instant Execution` — Legacy B-Book)** : Client `MqlTradeRequest` sends an **explicit desired price (`request.price`) + `deviation` points**. If current server tick stays within `±deviation`, it fills; if price moved beyond `deviation`, the server aborts with **`10004 Requote`** returning new Bid/Ask quotes!
2. **`SYMBOL_TRADE_EXECUTION_REQUEST` (`Request Execution` — OTC RFQ Large Size)**: Two-step Request-For-Quote (`RFQ`) workflow where the trader requests a firm two-way quote locked for `3–5 seconds`, then clicks accept/pass.
3. **`SYMBOL_TRADE_EXECUTION_MARKET` (`Market Execution` — Standard ECN / STP Bridge)**: Client submits volume with **`request.price = 0` (price is determined solely by live [LD4/NY4 liquidity bridge](/engines/liquidity-aggregation-bridge) VWAP depth)**! Zero requotes exist; `deviation` is ignored on server side!
4. **`SYMBOL_TRADE_EXECUTION_EXCHANGE` (`Exchange Execution` — Direct MOEX / DGCX / B3 / Equities)**: Direct exchange DMA gateway routing where pending orders rest natively inside the external exchange Central Limit Order Book rather than inside MT5 local pending table!

![MT5 MqlTradeRequest validation pipeline branching across Instant, Market, and Exchange execution modes plus SYMBOL_FILLING_MODE bitmask resolution](/api/figure?type=flow&title=MT5%20Execution%20Mode%20%26%20SYMBOL_FILLING_MODE%20Bitmask%20Pipeline&subtitle=Preventing%20Retcode%2010030%20%28Invalid%20Fill%29%20and%2010004%20%28Requote%29%20via%20dynamic%20bitmask%20negotiation&steps=1.%20Read%20Bitmask%3A%3AQuery%20SYMBOL_FILLING_MODE%20%281%3DFOK%2C%202%3DIOC%29%7C2.%20Mode%20Dispatch%3A%3AMarket%2FExch%20%28px%3D0%29%20vs%20Instant%20%28px%2Bdev%29%7C3.%20Bridge%20FIX%20Map%3A%3AMap%20IOC%20-%3E%2059%3D3%20%20%20FOK%20-%3E%2059%3D4%20%20%20Ret%20-%3E%2059%3D0%7C4.%20Deal%20Ledger%3A%3AAggregate%201..N%20Deals%20via%20OnTradeTransaction&metrics=RETCODE%2010030%3A%3A0%20Errors%3A%3ADynamic%20bitmask%20check%20active%7CMARKET%20REQUOTES%3A%3A0.00%25%3A%3ANo%2010004%20in%20Market%2FExchange%7CECN%20PREFERRED%3A%3AIOC%20%28Bit%202%29%3A%3ASweeps%20available%20LP%20rungs%7CEXCHANGE%20DEFAULT%3A%3ARETURN%3A%3ARests%20residual%20on%20CLOB)

## The Three Filling Policies (`FOK`, `IOC`, `RETURN`) & `10030` Bitmask Fix

Independently of Execution Mode, each symbol specifies an allowed **Filling Bitmask (`SymbolInfoInteger(sym, SYMBOL_FILLING_MODE)`)** mapped onto `request.type_filling`:
- **`ORDER_FILLING_FOK` (`Bit 1 = SYMBOL_FILLING_FOK`, FIX `59=4`)**: Fill `100%` of requested volume at available prices or cancel `100%` (`0` partial fills).
- **`ORDER_FILLING_IOC` (`Bit 2 = SYMBOL_FILLING_IOC`, FIX `59=3`)**: Fill maximum available liquidity immediately and **cancel any unfilled remainder** (`Essential for sweeping ECN bridges!`).
- **`ORDER_FILLING_RETURN` (`Default 0` when neither bit checked in `Exchange` / `Market` mode, FIX `59=0 Day`)**: Fill immediate available volume and **leave the unfilled remainder resting as a live Limit order on the book**!

**Mandatory MQL5 Engineering Rule**: Never hardcode `request.type_filling = ORDER_FILLING_FOK`! Always query `(uint)SymbolInfoInteger(_Symbol, SYMBOL_FILLING_MODE)` dynamically (`if ((filling & SYMBOL_FILLING_IOC) != 0) -> ORDER_FILLING_IOC`, else `FOK`, else `RETURN`)—or call `CTrade::SetTypeFillingBySymbol(_Symbol)`!

| MT5 Execution Mode | Client Sends Price? | `Requote (10004)` Possible? | Typical Filling Policy | Upstream Bridge / Venue Mapping |
| :--- | :--- | :--- | :--- | :--- |
| **`Instant` (`EXEMODE_INSTANT`)** | Yes (`price` + `deviation`) | **Yes (`High in fast mkt`)** | `FOK` / `Return` | Internal B-Book / Fixed-spread retail |
| **`Request` (`EXEMODE_REQUEST`)** | Step 1 Quote -> Step 2 Accept | Quote expires (`3–5s`) | `FOK` | OTC voice/electronic large-block RFQ |
| **`Market` (`EXEMODE_MARKET`)** ([MT5](/platforms/mt5-terminal-2)) | **No (`price = 0` Market)** | **Never (`0% Requotes`)** | **`IOC` or `FOK`** | **[LD4/NY4 Liquidity Bridge](/engines/liquidity-aggregation-bridge) (`FIX 59=3/4`)** |
| **`Exchange` (`EXEMODE_EXCHANGE`)** | Limit `price` or Market | **Never (`0% Requotes`)** | **`Return` or `IOC`** | Direct Exchange CLOB (`FIX 40=2, 59=0`) |

## MT5 Execution Mode × Filling Policy Compatibility & FIX Mapping Matrix

Exact server validation rules and upstream FIX 4.4 `OrdType (40)` / `TimeInForce (59)` translations across broker account tiers.

```formula
uint32_t mask = (uint32_t)SymbolInfoInteger(symbol, SYMBOL_FILLING_MODE);
ENUM_ORDER_TYPE_FILLING policy = (mask & SYMBOL_FILLING_IOC) ? ORDER_FILLING_IOC :
 (mask & SYMBOL_FILLING_FOK) ? ORDER_FILLING_FOK : ORDER_FILLING_RETURN;

P_instant_requote = P( |Price(t_server_rx) - Price(t_client_tx)| > Deviation_points * Point )
 = 2 * ( 1 - Phi( (Deviation_pips) / (Sigma_1s_pips * sqrt(RTT_sec)) ) )

Worked CPI Requote Probability (Instant Mode, Deviation = 0.3 pips, RTT = 0.16s, CPI Vol = 6.0 pips/s):
 Z = 0.3 / (6.0 * 0.40) = 0.125 -> P_requote = 2 * (1 - Phi(0.125)) = 90.05% of Instant orders REQUOTED!
```

## Where Do Pending Limit & Stop Orders Live? (`MT5 Server RAM` vs `LP Book`)

A critical execution question for scalpers on [MT5](/software/mt5) vs [cTrader](/software/ctrader): when you place a `Buy Limit` 10 pips below market in **`Market Execution`** mode vs **`Exchange Execution`** mode, where does your order sit?
- **In `Market Execution` (95% of OTC FX/CFD Brokers)**: Pending `Buy Limit`, `Sell Stop`, `SL`, and `TP` orders generally rest **locally inside the MT5 Trade Server RAM** until an incoming LP tick touches your trigger level—at which millisecond MT5 converts the triggered order into an outbound `IOC` / `Limit` bridge request! (Note: select institutional bridges mirror `Limit` orders upstream as resting LP limit orders to capture maker priority.)
- **In `Exchange Execution`**: Limit orders route **immediately upstream** to rest directly inside the external exchange FIFO queue! Review full server topology in our [MT5, cTrader & Liquidity Bridge Architecture Guide](/reports/mt5-ctrader-liquidity-bridge-server-topology-execution-logs-guide) and [Virtual Dealer vs Market Execution audit](/reports/virtual-dealer-plugin-artificial-delay-vs-market-execution-audit).

![Successful fill completion rate during volatile US CPI across Instant Execution (3-pt dev), Market FOK, Market IOC, and Exchange Return policies on 20-lot orders](/api/figure?type=bars&title=20-Lot%20Order%20Completion%20Rate%20During%20CPI%20Volatility%20%28%25%29&subtitle=Percentage%20of%20institutional-size%20tickets%20filling%20without%20rejection%20across%20MT5%20modes&steps=Market%20Execution%20%2B%20IOC%3A%3A99.1%25%20filled%20%20%20Sweeps%20multi-LP%20VWAP%7CExchange%20Execution%20%2B%20Return%3A%3A98.4%25%20filled%20%20%20Fills%20top%20%2B%20rests%20tail%7CMarket%20Execution%20%2B%20Strict%20FOK%3A%3A74.2%25%20filled%20%20%20Aborts%20if%2019.5%2F20%20avail%7CInstant%20Execution%20%283-pt%20Dev%29%3A%3A31.5%25%20filled%20%20%2068.5%25%20Requote%20%2810004%29!&metrics=INSTANT%20FAILURE%3A%3A68.5%25%20Requote%3A%3ATick%20moves%20%3E3%20pts%20in%20WAN%20RTT%7CFOK%20CLIFF%20RISK%3A%3AAll-or-None%3A%3AFails%20if%20LP%20depth%20%3C%20100%25%20qty%7CSTOP-LIMIT%20TYPE%3A%3ANative%20MT5%3A%3ABUY_STOP_LIMIT%20supported%7CFIX%20EQUIVALENT%3A%3ATag%2040%20%2B%2059%3A%3A1%3A1%20standard%20OMS%20mapping)

## Handling Partial Fills Cleanly in `OnTradeTransaction` Event Loops

Under `IOC` and `RETURN` on ECN bridges, a `50.0-Lot` order swept across 3 LPs can generate **multiple `DEAL_ENTRY_IN` partial deals** sharing a single `ORDER_TICKET`! Naive EAs polling `OrderSend` synchronously assuming `1 Order == 1 Deal` miscount inventory under [UK FCA](/standards/fca) and [NFA](/standards/nfa) risk controls; always reconcile via `OnTradeTransaction(trans, request, result)` keyed on `DEAL_ORDER`!

Size maximum partial-sweep exposure inside the [Terminal Margin VaR & ES Calculator](/calculators/terminal-margin-var-es-calculator) and explore MQL5 async execution in the [MT5, cTrader & Bridge Topic Hub](/topics/mt5-ctrader-bridge-dealer-architecture).

- [Decoding MT5 & cTrader Client Journal Logs: Millisecond TCA, Requotes & Off Quotes](/reports/decoding-mt5-ctrader-client-journal-logs-requotes-off-quotes-ms-tca)

## Frequently asked questions

### Why does MQL5 return Error 10030 (Unsupported filling mode) on some brokers but not others?

Each broker configures allowed fill bitmasks per symbol group to match its upstream liquidity bridge (for example, an LD4 ECN bridge supporting only IOC disables FOK bit 1). Hardcoding ORDER_FILLING_FOK fails whenever Bit 1 is 0 in SYMBOL_FILLING_MODE.

### Does setting request.deviation = 5 inside MQL5 protect Market Execution orders from slippage?

No! Under SYMBOL_TRADE_EXECUTION_MARKET, the MT5 server ignores the client deviation parameter completely because Market orders execute at live market depth. To cap worst-case entry price on an ECN account, submit a marketable Limit order (or BUY_STOP_LIMIT) instead!

### What is ORDER_FILLING_RETURN and why is it standard in Exchange Execution mode?

ORDER_FILLING_RETURN mirrors standard stock/futures exchange Day limit behavior (FIX TimeInForce 59=0): if you buy 1,000 shares at $50.00 and only 600 are offered at $50.00, 600 fill immediately and the remaining 400 rest visibly on the bid at $50.00.

### How does MT5 ORDER_TYPE_BUY_STOP_LIMIT combine Stop triggers with slippage protection?

Unlike a plain Buy Stop that fires an uncapped Market order when price hits StopPrice (risking news-gap slippage), Buy Stop Limit waits until price touches price (Stop trigger) and then places a price-capped Buy Limit at stoplimit—capping maximum slippage deterministically!


## Source URLs

- https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_trade_execution
- https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling
- https://www.fixtrading.org/standards/fix-4-4/

## Citation

- APA: Marcus Thorne, CQF. (2026). MT5 Execution Modes & Fill Policies: Instant, Request, Market, Exchange & IOC/FOK. Terminal Ledger Desk. https://terminalledgerdesk.com/reports/mt5-execution-modes-instant-request-market-exchange-fill-policies
- Canonical article: [MT5 Execution Modes & Fill Policies: Instant, Request, Market, Exchange & IOC/FOK](https://terminalledgerdesk.com/reports/mt5-execution-modes-instant-request-market-exchange-fill-policies)
- Site research index: [Terminal Ledger Desk](https://terminalledgerdesk.com/llms-full.txt)
