MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 isn’t reliable.
If you want to check Opened/Closed market you should use these functions together (both in MT4 and MT5):
SymbolInfoSessionTrade() => to find the last session start/end time
SymbolInfoInteger(_Symbol,SYMBOL_TIME) => to find out the last known tick time for the symbol
TimeCurrent() and TerminalInfoInteger(TERMINAL_CONNECTED) => to find out if the server is "ON"