Page 1 of 1

OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sat Oct 24, 2026 7:52 pm
by Fairman
OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

An EA that loops over a list of symbols can get stuck on one the broker has switched to Close Only. Brokers can do that for an expiring contract or a symbol being delisted. Every new entry then comes back from OrderSend with retcode 10044, TRADE_RETCODE_CLOSE_ONLY, which means only position closing is allowed. Its neighbours are 10042 for long only and 10043 for short only.

If the EA treats every retcode other than 10009 as a temporary fault and retries on each tick, it sends a doomed request on every tick until someone notices.

Reading the mode before sending is cleaner:
long mode = SymbolInfoInteger(sym, SYMBOL_TRADE_MODE);
if(mode == SYMBOL_TRADE_MODE_DISABLED || mode == SYMBOL_TRADE_MODE_CLOSEONLY) return;
bool canBuy = (mode == SYMBOL_TRADE_MODE_FULL || mode == SYMBOL_TRADE_MODE_LONGONLY);
bool canSell = (mode == SYMBOL_TRADE_MODE_FULL || mode == SYMBOL_TRADE_MODE_SHORTONLY);

Closing still works in Close Only, so the exit logic should keep running for positions that are already open. A symbol can also go back to Full access later, so the check belongs inside the entry path each time, not in a flag set once at start. With twenty symbols, keep the mode per symbol, since one going Close Only should not silence the other nineteen.

Re: OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sun Oct 25, 2026 8:00 pm
by FXS HongKong Scalper
A very practical post. Handling 10044 by removing the symbol from the active list until the next day stops the EA from spamming requests. It is also worth logging the event and sending a notification, since a close only state can mean a symbol is being delisted or rolled, and any open position should be checked by hand.

Re: OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sat Oct 31, 2026 5:40 am
by Fairman
Pending orders and reversals behave less predictably. Depending on the server, a pending order on a symbol that goes Close Only may be rejected when it triggers, or removed. Do not assume it survives; after a mode change, compare OrdersTotal with what the EA expects. Reversals are another trap. Suppose you hold 2 lots long on a netting account and the EA sends a sell of 3 lots, intending to close 2 and open 1 short. In Close Only that request can be refused, because part of it would open a position. Size exits to the position volume exactly, read from PositionGetDouble(POSITION_VOLUME), and open the new side only when the mode allows it.

Re: OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sat Oct 31, 2026 6:14 am
by Fairman
Log it, but not on every tick. A throttled message keeps the journal readable:
static datetime lastLog = 0;
if(TimeCurrent() - lastLog > 3600)
{
PrintFormat("%s: retcode %d, trade mode %d, entries skipped", sym, res.retcode, (int)mode);
lastLog = TimeCurrent();
}
One line an hour per symbol tells you the EA noticed the state and is behaving, without burying other messages. If the symbol is one of twenty, keep a lastLog per symbol or the first symbol's message will silence all the others. When the line stops appearing and entries resume, the mode has gone back to full access and you can see roughly when from the journal.

Re: OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sat Oct 31, 2026 7:01 am
by Fairman
To see the mode by hand, open Market Watch, right click the symbol, choose Specification and look at the trading mode entry. It can change without notice, so an EA should read it again when it matters. SymbolInfoInteger is a cheap call, and checking once per new bar is usually enough: an M5 chart gives 288 checks a day, against thousands of ticks. The exception is a symbol where a mode change could trap an open position you want to adjust, in which case read it each time before modifying. Keep the broker's announcements in the loop too, since expiries and delistings are normally announced ahead of time, and a calendar entry beats a surprise at three in the morning.

Re: OrderSend retcode 10044 on one symbol: Close Only mode and how an EA reacts

Posted: Sat Oct 31, 2026 7:25 am
by Fairman
You can test the branch without waiting for a broker to flip anything. Wrap the mode in a function, ModeAllowsEntry(sym, dir), and add an input called TestForceCloseOnly. When it is true the function returns false whatever the server says. Run the EA in the tester with it set to true, then check the journal: the number of OrderSend calls should be zero and the exit logic should still manage any positions opened beforehand, which you can seed by running a first leg with the flag false. A test like this takes ten minutes to write and covers the case that otherwise appears for the first time on a live account with real positions.