Guides, manuals and platform references.
November 20, 2026 · View Markdown
A pending order is accepted with Return filling. An immediate buy on the same MT5 symbol is rejected with an invalid filling type. That can be consistent behavior: the request type and the symbol’s execution mode matter together.
For automated trading, this distinction belongs at the execution end of the workflow. If you use AlgoWay with the MT5 Expert Advisor, keep the original signal separate from the terminal’s order result when diagnosing a rejection. A valid trading condition does not establish that every order policy is available at the broker.
An order type describes the requested action, such as an immediate buy or a pending buy limit. The broker-defined execution mode describes the symbol’s price-execution framework. A filling policy describes what may happen when the requested quantity cannot be filled completely. These are separate choices, even though their names often appear in the same error report.
MetaQuotes documents the execution mode as a broker setting for each symbol. A program selects its filling policy within the applicable rules; choosing a policy does not change that execution mode. See the MQL5 explanation of execution and filling.
| Symbol execution mode | FOK | IOC | Return |
|---|---|---|---|
| Instant | Allowed | Allowed | Allowed |
| Request | Allowed | Allowed | Allowed |
| Market | If symbol permits | If symbol permits | Not allowed |
| Exchange | If symbol permits | If symbol permits | Allowed |
This matrix follows the MQL5 order-properties reference for immediate execution. FOK requires the whole requested quantity; IOC permits a partial fill and cancels the unfilled balance; Return keeps the remaining quantity in processing after a partial fill. A permitted policy is still not a promise that a particular order will execute.
Pending-order submission has a separate rule: MetaQuotes specifies Return regardless of the symbol’s execution mode because the order is being placed for later execution. The broker’s supported rules govern that later fill. Do not carry the immediate-execution matrix across to pending-order placement.
Consider a constructed example, not a recorded trade. A symbol uses Market Execution and permits IOC but not FOK. An automated system requests an immediate buy of 1.00 lot with Return filling. The policy is incompatible before any conclusion about available liquidity is useful. Increasing price deviation or moving a stop does not repair that mismatch.
Now suppose the system instead submits a valid pending buy limit using Return. That request follows the pending-order rule. Its acceptance would not contradict the earlier rejection, nor would it establish that an immediate Return order is supported.
Changing the immediate request to IOC changes the intended outcome as well as eligibility. If only 0.60 lot can fill under that request’s conditions, the remaining 0.40 lot is canceled. The strategy must decide whether the smaller position is acceptable. Switching to another policy merely to silence an error is a poor substitute for deciding what partial execution should mean.
Start with the actual server response. MetaQuotes identifies 10030, TRADE_RETCODE_INVALID_FILL, as an invalid filling type in its trade-server return-code reference. Invalid volume and invalid stops have different codes. Avoid diagnosing every failed submission from a generic “trade failed” message.
Record the symbol on the receiving account, whether the request was immediate or pending, the requested policy, and the current symbol execution and filling settings. For a developer, the public MQL5 properties are SYMBOL_TRADE_EXEMODE and SYMBOL_FILLING_MODE. The latter contains permission flags, not a ready-made order-policy value to copy blindly. That distinction is documented in the MQL5 execution chapter linked above.
Then compare the request with the applicable row or pending-order rule. If the software chooses the policy internally and offers no user setting, give its maintainer this compact evidence rather than changing unrelated alert fields. Do not assume an example that worked on another symbol or broker establishes permission here.
Before a controlled retry, check current positions and working orders from any earlier attempts. Our IOC, FOK and GTC guide explains the different account states after partial execution. For MT5 history specifically, distinguish orders, deals and positions. The aim is an eligible request whose possible outcomes the strategy can handle, not an endless loop trying every policy until something fills.