MQL4 Reference Checkup IsTradeAllowed
Checks if the Expert Advisor is allowed to trade and trading context is not busy.
The second form of the function checks trade status for the specified symbol in the specified time.
[in] Time to check status.
Returns true if the Expert Advisor is allowed to trade and trading context is not busy, otherwise returns false.
OrderSend(), OrderClose(), OrderCloseBy(), OrderModify(), OrderDelete() trading functions changing the state of a trading account can be called only if trading by Expert Advisors is allowed (the "Allow live trading" checkbox is enabled in the Expert Advisor or script properties).
IsDllsAllowed(), IsLibrariesAllowed(), IsTradeContextBusy()