Python working with multiple MT5 terminals

 
I work with Python and an MT5 terminal and it works correctly.
I want to expand to 3 terminals  with different accounts (3 accounts too) and I don't see the way.

I have tried to solve it with a connection to a portable terminal and it gives me an error.

path = "F:\MT5 Portable\terminal64.exe"
modo = True
ticker='SP500'
cuentaMt5=3546465415
serverMt5="Darwinex-Demo"
passwordMt5="luhvuahfu"

if not initialize(path, login=cuentaMt5, server=serverMt5, password=passwordMt5, portable=modo): #modo portable
        ...
        ...
initialize() failed, error code = (-10003, "IPC initialize failed, Process create failed 'F:\\MT5 Portable\terminal64.exe'")
OOP in MQL5 by Example: Processing Warning and Error Codes
OOP in MQL5 by Example: Processing Warning and Error Codes
  • www.mql5.com
The article describes an example of creating a class for working with the trade server return codes and all the errors that occur during the MQL-program run. Read the article, and you will learn how to work with classes and objects in MQL5. At the same time, this is a convenient tool for handling errors; and you can further change this tool according to your specific needs.
 

More tests performed:

terminal_path_1 = "I:\\Software\\ MetaTrader 5\\terminal64.exe"
terminal_path_2 = "I:\\Software\\ MetaTrader1\\terminal64.exe"

print(mt5.initialize(terminal=terminal_path_2))
mt5.shutdown()

print (mt5.initialize(terminal=terminal_path_1))
mt5.shutdown()

The same Path_1 always opens for me and it doesn't close

 

I have edited your posts ...

  • On the English forum, please write in English. Either use the automatic translation tool, or post in one of the other language forums.
  • Please use the CODE button (Alt-S) when inserting code.

    Code button in editor

 
Try to find a solution here. Out of the box MT5 does not support multiple instances bound to python at the same time, at the moment.
MT5/Metatrader 5 connect to different MT5 terminals using python
MT5/Metatrader 5 connect to different MT5 terminals using python
  • 2020.09.20
  • usert4jju7 usert4jju7 1,803 6 6 gold badges 31 31 silver badges 68 68 bronze badges
  • stackoverflow.com
I've got multiple python programs that connect to Mt5 terminal using the following code. The problem I have is that, when multiple programs connect to the same MT5 , the performance degrades & one or more python programs exit with errors. To overcome this, I have installed multiple copies of MT5 & have updated the python code such that...
 
Fernando Carreiro #:

I have edited your posts ...

  • On the English forum, please write in English. Either use the automatic translation tool, or post in one of the other language forums.
  • Please use the CODE button (Alt-S) when inserting code.

thanks