MT4 error 147: Expirations are denied by broker (ERR_TRADE_EXPIRATION_DENIED)
The broker doesn't allow expiry times on pending orders. Send the order with expiration 0 and cancel it yourself later.
What it means
You see this code in GetLastError() in MQL4, after a trade function fails on the server side.
You set an expiration on a pending order and the broker doesn't accept expirations.
The order wasn't placed.
Common causes
- A non-zero
expirationargument inOrderSend()orOrderModify()at a broker that refuses it.
How to fix it
- Pass 0 as the expiration.
- Keep your own end time and delete the order with
OrderDelete()when it passes.
Example in MQL4:
RefreshRates();
double price = NormalizeDouble(Ask - 300 * Point, Digits);
int ticket = OrderSend(Symbol(), OP_BUYLIMIT, 0.10, price, 3, 0, 0, "", 4711, 0); // no expiry
datetime myExpiry = TimeCurrent() + 4 * 3600; // delete it yourself after this Is it safe to retry?
Yes, without an expiration.
Could the order have executed?
No order was placed.
How Tickwire handles it
Tickwire treats it like MT5 10022, and the MT4 code stays in the message.
On MT4 accounts, DAY and SPECIFIED_DAY expiry is refused with not_supported_on_mt4 before sending. Use a set expiry time, or none. See platforms.
Related codes
One API for MT4 and MT5
Clear trade outcomes, idempotent orders and an audit log. Read the error reference or the quickstart.