Simplest way to close a remote MT5 (launching a local MT5) ?

 
I have 2 MT5 that aren't on the same network, installed on different Windows computers.

Both can trade the same account BUT I don't want them to be opened & ready to trade simultaneously.

When I launch MT5 #1, I want it to close MT5 #2 (if it is opened)
When I launch MT5 #2, I want it to close MT5 #1 (if it is opened)

I have noticed that "TerminalClose()" can close a terminal.
I have also read about MQL5 network functions https://www.mql5.com/en/docs/network but I'm a bit lost...

What is the simplest way to close a running remote MT5 terminal (launching a local MT5 terminal)?

Thanks very much!
Documentation on MQL5: Network Functions
Documentation on MQL5: Network Functions
  • www.mql5.com
Network Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
anything can be programmed. but if you dont know programming code, then use remote desktop apps on the web that you can access via a web browser and then use a keyboard and mouse remotely to control your 2nd computer. There are several free ones online. just do google search.
 

Thank you, I know how to program.

I was just wondering what is the easiest way a GOOD programmer would choose (named pipes ? shared memory ? shared website ?....)

I don't want to launch a remote desktop every time, just to check if the remote computer is running MT5 or not.

When I launch my local MT5, I want it to close the remote MT5 transparently (if it is running, without the hassle of having to connect each time with a remote desktop program).

Thanks

 
ccou #:

Thank you, I know how to program.

I was just wondering what is the easiest way a GOOD programmer would choose (named pipes ? shared memory ? shared website ?....)

I don't want to launch a remote desktop every time, just to check if the remote computer is running MT5 or not.

When I launch my local MT5, I want it to close the remote MT5 transparently (if it is running, without the hassle of having to connect each time with a remote desktop program).

Thanks

ok. but whats wrong with connecting to a vps every time? Most remote desktop programs run in the system tray and all you ahve to do is right click and select run or close. How hard or time consuming that?

 

a method i have considered is creating a telegram bot. Idea being when i open home terminal i have an ea notify the bot that I am running my local terminal; the bot sends a msg to my vps to stop opening new trades.

and then before i close my local terminal i would click my button to notify the bot that the vps may resume trading. 

But then I am not a professional coder haha but i can dream!

 
Revo Trades #: ok. but whats wrong with connecting to a vps every time? Most remote desktop programs run in the system tray and all you ahve to do is right click and select run or close. How hard or time consuming that?

I suspect the OP trying to build an automated redundancy system for the case when one system is down, the other picks it up.

However, this is not an simple task for beginner. It requires advanced logic and programming skills and experience in multiples areas, not just in MQL.

 

Revo Trades #:

....i have an ea notify the bot that I am running my local terminal;

....the bot sends a msg to my vps to stop opening new trades.

1) How would your local MT5 EA notify the bot?    WebRequest, SendMail ?

2) How would the remote MT5 be stopped to open new trades?

3) More generally, how can 2 MT5 EAs communicate over the internet?

Thanks!

 
Fernando Carreiro #:

I suspect the OP trying to build an automated redundancy system for the case when one system is down, the other picks it up.

Nope, nice guess, it's just that I don't want the remote MT5 (that I forget to close sometimes) EA to close my local trades, just because the remote EA pips SL is lower than my current local MT5 pips SL.

Thanks

 
ccou #: Nope, nice guess, it's just that I don't want the remote MT5 (that I forget to close sometimes) EA to close my local trades, just because the remote EA pips SL is lower than my current local MT5 pips SL.

MetaTrader's network functionality always acts as a "client". It cannot function as a "server".

So you will need a separate network application to act as the server or intermediary between the two.

 
ccou #:

1) How would your local MT5 EA notify the bot?    WebRequest, SendMail ?

2) How would the remote MT5 be stopped to open new trades?

3) More generally, how can 2 MT5 EAs communicate over the internet?

Thanks!

It is just an idea i have thought about when I have considered alternate method of stopping the vps when i want to use my local instead without shutting down mt5 on the vps; currently i use microsoft remote desktop program to log into my vps when i am on my local, and i either shutdown mt5 on the vps OR close my charts on the vps so that I can trade from my local, and before i shutdown my local, I login to my vps again and load up my custom profile and template with my ea to resume trading on the vps. takes about 30 - 45 seconds to do either task.

1) either/or.

2) the ea or chart would be removed with a template, probably, but this is just a guess.

3) The idea of using Telegram is that they do not communicate, or they communicate as li'l as possible -- so as to avoid affecting trading.

But I am happy with the 45 second process as it is, and i think it will have to become a lot tiresome before I am motivated enuf to seriously consider again an alternate process such as using Telegram. But I am sure that there would be articles on this site discussing telegram bots, and i bet there is already a product or 2 or 3 on marketplace to do what i detailed.

Reason: