I've already connected to the mt5 terminal and server and gathered the data I wanted, but sometimes, almost randomly, the mt5.initialize returns the Error (-10005, 'IPC timeout')
That's how I initialize it.
import MetaTrader5 as mt5
# establish connection to the MetaTrader 5 terminal
if not mt5.initialize(login=self.login, server=self.server,password=self.password):
print("Error code:", mt5.last_error()))
mt5.shutdown()
I've already tried some solutions that can be found here in StackOverflow or some other communities, but none of them work consistenly, here are some of those:
if not mt5.initialize(path=self.path, login=self.login, server=self.server, password=self.password):
print("Error code:", mt5.last_error())
mt5.shutdown()
or
if not mt5.initialize():
print("Error code:", mt5.last_error())
mt5.shutdown()
or even
if not mt5.initialize(path=self.path):
print("Error code:", mt5.last_error())
else:
if mt5.login(login=self.login, server=self.server, password=self.password):
print("logged in succesffully")
else:
print("Error code:", mt5.last_error())
And none of them corrects the possibility of getting the Error -10005 now and then. The MetaTrader5 documentation says it's a internal timeout, but how to solve it so my program become more stable?