MT4 error 9: Malfunctional trade operation (ERR_MALFUNCTIONAL_TRADE)
A rare MT4 code for a trade operation that went wrong in an unexpected way. Nothing was executed; check the request and the Journal.
What it means
You see this code in GetLastError() in MQL4, after a trade function fails on the server side.
Error 9 says the trade operation itself was faulty. You will rarely see it.
Treat it as a refusal of this request, and look for the reason in the request and in the terminal's Journal.
Common causes
- A request that conflicts with the order's current state.
- A server side fault.
How to fix it
- Read the order again with
OrderSelect()and rebuild the request from fresh values. - Check the Journal tab for details.
- Ask the broker if it repeats.
Example in MQL4:
if(!OrderModify(ticket, price, sl, tp, 0))
{
int err = GetLastError();
if(err == ERR_MALFUNCTIONAL_TRADE && OrderSelect(ticket, SELECT_BY_TICKET))
PrintFormat("order %d now: type %d, open %.5f, sl %.5f, tp %.5f",
ticket, OrderType(), OrderOpenPrice(), OrderStopLoss(), OrderTakeProfit());
} Is it safe to retry?
After rebuilding the request.
Could the order have executed?
No. The server rejected the operation as malformed, so nothing changed.
How Tickwire handles it
Tickwire treats it like MT5 10006, and the MT4 code stays in the message. See trade results.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.