How to deal with multiple MT4 logins? - page 2

 
ggekko:
Maybe you are right, but not sure. There is a common point ("communication-channel"), the account itself.

Yes, as I said the only communication possible is with the broker and that is why Doerk wanted to know if there was some less used function that would allow that out-of-channel communication between instances of the EAs.

Personally, I don't believe there is any out-of-channel solution, leaving only the Order management communications as a possibility. Hence, my two possible solutions:

  1. Detecting other orders that were not initiated by the EA in question, or
  2. Placing a "fake" pending order at an impossible price to serve as a locking semaphore.
However, neither of these are ideal and are actually quite "messy", but they may turn out to be the only viable ones.
 

The fake order does sound interesting, one could create a communication pipe using the orders comment. And due to the circumstance that actually each broker has a EURUSD symbol, this should be possible. If I decide to do it that way, I ll post it as a class library at the Code Base.

Thank you. 

 
Doerk:

The fake order does sound interesting, one could create a communication pipe using the orders comment. And due to the circumstance that actually each broker has a EURUSD symbol, this should be possible. If I decide to do it that way, I ll post it as a class library at the Code Base.

Thank you. 

Be careful, brokers themselves too used to modify the order comments.
 
Doerk:

The fake order does sound interesting, one could create a communication pipe using the orders comment. And due to the circumstance that actually each broker has a EURUSD symbol, this should be possible. If I decide to do it that way, I ll post it as a class library at the Code Base.

Thank you. 

Using the comment may seem ideal, but unfortunately not all brokers work with it. Some block it completely, some truncate its length, others may even add their own comments to it.

The only guarantee is to use it as a semaphore. If its already there, then the EA has already been started somewhere else and the user is asked whether to cancel and exit the EA or to ignore it and proceed (for example after a crash, where the order is left open).

You could also use the order type for an extra bit of info, but that only leaves you with 4 possibilities which is not that useful. The price itself could also be changed slightly as a variable, but not too much.

The only variables that could be "almost" freely changed to offer extra information, would be the price values for the Stop-Loss and Take-Profit.

Reason: