MT5WaitForTerminal

Wait till the MetaTrader 5 terminal connects to the trade server.

MT5WaitForTerminal()

Return Value

Returns True if the MetaTrader 5 terminal successfully connects to the trading server, otherwise - False.

Note

The MT5Version() function returns connection status, trade server address and trading account number as a tuple.

The waiting time is 1 minute. MT5TerminalInfo() should be called to check the connection status after MT5WaitForTerminal().

Example:

from datetime import datetime
from MetaTrader5 import *
 
# connect to MetaTrader 5
MT5Initialize()
# wait till MetaTrader 5 connects to the trade server
MT5WaitForTerminal()
# display data on connection status, server name and trading account
print(MT5TerminalInfo())
# display data on MetaTrader 5 version
print(MT5Version())
# shut down connection to the MetaTrader 5 terminal
MT5Shutdown()

See also

MT5Initialize, MT5TerminalInfo, MT5Version, MT5Shutdown