What MQL4 error 4109 means
The official MQL4 runtime table names error 4109 ERR_TRADE_NOT_ALLOWED and defines it as “trade is not allowed; enable Allow live trading in the Expert Advisor properties.” The local EA or terminal trading permission prevents the request before strategy logic can place a live trade.
An error-state value is supporting context, not proof that a call failed or a diagnosis of the whole EA. For noncritical API failures, read the return value and then GetLastError, which resets _LastError. Critical errors such as zero division terminate execution, so code after the failing expression cannot serve as a recovery handler.
