Programmatic operation of other terminal when two MT4 are running

 

Hi,

Could someone give me tips for this ?

1. Two MT4 are running on the same PC. (each terminal is working on a different account number but of the same broker and account type)

2. I want to create a Expert Advisor code that runs on one of these terminals (let's say 'terminal A') and monitor/operate positions on the other MT4 terminal (terminal B) where other EA (bought from the market) is working.

3. How can I monitor/operate (e.g. count the number of positions, close positions, cancel orders, stop autotrading etc.) on terminal B from this EA on terminal A  ?

4. I'm also keen to know how to programmatically know/capture the Window Handle of the other MT4 terminal (terminal B) from within this EA on terminal A.

Thank you.

 
Fairy:

Hi,

Could someone give me tips for this ?

1. Two MT4 are running on the same PC. (each terminal is working on a different account number but of the same broker and account type)

2. I want to create a Expert Advisor code that runs on one of these terminals (let's say 'terminal A') and monitor/operate positions on the other MT4 terminal (terminal B) where other EA (bought from the market) is working.

3. How can I monitor/operate (e.g. count the number of positions, close positions, cancel orders, stop autotrading etc.) on terminal B from this EA on terminal A  ?

4. I'm also keen to know how to programmatically know/capture the Window Handle of the other MT4 terminal (terminal B) from within this EA on terminal A.

Thank you.

Here explains how to do it: https://www.mql5.com/en/blogs/post/706665

Socket library for MT4 and MT5
Socket library for MT4 and MT5
  • 2017.09.06
  • www.mql5.com
For anyone not used to socket programming: the model is that you create a server socket; you accept connections on it; and each acceptance creates a new socket for communicating with that client. No data is sent or received through the server socket itself. You create a server socket using an instance of ServerSocket(), telling the constructor...
 
Fernando Morales:

Here explains how to do it: https://www.mql5.com/en/blogs/post/706665

Hi Fernando Morales, Thanks for the link. I'll check it out.