currently, I am creating the python script to pulling m5 data (login with XM broker). Yesterday, the code ran well but it failed today. I have tried to run the code in jupyter notebook but it still worked well (receiving the data), however it returns empty when using termial to trigger the .py file.
this is my code (already imported all the packages):
try:
mt5.initialize()
login = 1223331112
password = 'MyPassword'
server = 'XMGlobal-MT5 7'
symbol = 'EURUSD'
timeframe = mt5.TIMEFRAME_M5
n = 200 # number of bars to get data
mt5.login(login, password, server)
if mt5.initialize():
logging.info(f'Logined MT5 - {mt5.terminal_info()}')
else:
logging.info(f'initialized failed, error code = {mt5.last_error()}')
mt5.shutdown()
quit()
rates = mt5.copy_rates_from_pos(symbol, timeframe, 0, n)
print(rates)
except Exception as e:
logging.error(f"An error occurred: {str(e)}")
does anyone know what is the possible root cause and what I can do? runing the script using python 3.9.11 on windows 10
Hi all,
currently, I am creating the python script to pulling m5 data (login with XM broker). Yesterday, the code ran well but it failed today. I have tried to run the code in jupyter notebook but it still worked well (receiving the data), however it returns empty when using termial to trigger the .py file.
this is my code (already imported all the packages):
does anyone know what is the possible root cause and what I can do? runing the script using python 3.9.11 on windows 10