initialize() failed, error code = (-10003, "IPC initialize failed, Process create failed 'C:\\Program Files\\ICMarkets - MetaTrader 5 - 02\terminal64.exe'")
This could be something to do with Windows's default pointing to the first installation or something like that that you wouldn't even think about. Just thinking aloud here.
From my experience, imho, the MT5 python API was not designed to handle multiple connections from the same machine simultaneously.
I have overcome this by creating Virtual Machines and running everything through them.
I used Oracle VM because it's free, I had past experience with it, but its not very good at sharing resources.
If your machine is not very strong you might want to look into some other solution.
I heard Docker is good at sharing the host resources.
–
The problem is with The python module for MT5 https://www.mql5.com/en/docs/integration/python_metatrader5
they coded that module in such way that don't allow you to run multiple instances of that module , you can connect to one terminal only.
but I have a dirty fix for this issue,follow carefully! :
1 - copy the metatrader5 python package from C:\Users\your_user_name\AppData\Local\Programs\Python\Python38\Lib\site-packages\MetaTrader5
2 - add it to your project location
3 - duplicate the "MetaTrader5" Folder inside your project and rename it to different name like "Meta2"
4 - Import that folder like this :
import MetaTrader5 as mt5
import Meta2 as mt2
import time
if not mt5.initialize(path="C:/Program Files/Fusion Markets MetaTrader 5/terminal64.exe",login=xxxx, server="FusionMarkets-Demo",password="xxxxx"):
print("initialize() failed, error code =",mt5.last_error())
if not mt2.initialize(path="C:/Program Files/MetaTrader 5 EXNESS/terminal64.exe",login=xxxxx, server="Exness-MT5Trial",password="xxxxx"):
print("initialize() failed, error code =",mt5.last_error())
fusion_ticker = mt5.symbol_info_tick("EURUSD")
exness_ticker = mt2.symbol_info_tick("EURUSDm")
You must include terminal64.exe
in path. This worked for me:
path1='C:\\Program Files\\Capitaria MT5 Terminal\\terminal64.exe'
path2='C:\\Program Files\\Admiral Markets MT5\\terminal64.exe'
# login to first account
account1_result = mt5.login(account1["login"], account1["password"], account1["server"])
if account1_result:
print(f"Logged in to account {account1['login']}")
else:
print(f"Failed to login to account {account1['login']}: {mt5.last_error()}")
# login to second account
account2_result = mt5.login(account2["login"], account2["password"], account2["server"])
if account2_result:
print(f"Logged in to account {account2['login']}")
else:
print(f"Failed to login to account {account2['login']}: {mt5.last_error()}")
# disconnect from MT5 servers
mt5.shutdown()
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.