mt5.python
MT5 Python Market Close Evaluation
1
2symbol_time = mt5.symbol_info("XAUUSD").time
3
4symbol_time = pd.to_datetime(symbol_time, unit='s')
5
6
7(symbol_time.hour == 23)
8(symbol_time.minute >= 30)
This code will check market watch time for a specific symbol, in most of time markets are clsoed at above time. so the robot should stop trading.
this code could go to your while loop of the robot(AT).
as below:
1while True:
2 symbol_time = mt5.symbol_info("XAUUSD").time
3 symbol_time = pd.to_datetime(symbol_time, unit='s')
4
5 if (symbol_time.hour == 23) and (symbol_time.minute >= 30):
6 is_time = False
7 else:
8 do your trade