What MQL4 error 149 means
The official MQL4 runtime table names error 149 ERR_TRADE_HEDGE_PROHIBITED and defines it as “an attempt to open an order opposite to the existing one when hedging is disabled.” The trade request tries to open an order in the opposite direction of one that is already open, and hedging is disabled.
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.
