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.
The error number is evidence about one failed call, not a diagnosis of the whole EA. Read the API sentinel first, then call GetLastError immediately because that function returns the current _LastError value and resets it.
