How to separate trades from other EAs and from manual trades

 
Comments that do not relate to the "In the strategy tester, how to manually place orders ?", have been moved into this topic.
 

Hello, a simple  question :

If i'm using an EA on EURUSD for example that open some trade and close them at certain level, but simultaneously i open a trade manually...this manual open trade will close itself at the same level closeorder of the EA or it is indipendent?

 
Dario Capasso #: If i'm using an EA on EURUSD for example that open some trade and close them at certain level, but simultaneously i open a trade manually...this manual open trade will close itself at the same level closeorder of the EA or it is indipendent?

@Dario Capasso, please don't hijack someone else's thread, especially if it has nothing to do with your issue. Start your own new thread or find a thread that is relevant to your situation.

In answering your question, EA's should use a "magic number" to separate trades from other EAs and from manual trades so that their operations don't interfere with each other. Manual trades have a magic number of "0".

 
Fernando Carreiro #:

@Dario Capasso, please don't hijack someone else's thread, especially if it has nothing to do with your issue. Start your own new thread or find a thread that is relevant to your situation.

In answering your question, EA's should use a "magic number" to separate trades from other EAs and from manual trades so that their operations don't interfere with each other. Manual trades have a magic number of "0".

Oh ok sorry, i didn't want to take space to other for a my simple question but ok next time i will. So if the EA has not set a magic number it will interfere with other manual trades?

 
Dario Capasso #: Oh ok sorry, i didn't want to take space to other for a my simple question but ok next time i will. So if the EA has not set a magic number it will interfere with other manual trades?

EA's by their nature of the code ALWAYS set a magic number which is usually defined in the parameter, so will normally not interfere, unless they purposely set it to "0".

If you are writing your own EA then take that into account.

 
Fernando Carreiro #:

EA's by their nature of the code ALWAYS set a magic number which is usually defined in the parameter, so will normally not interfere, unless they purposely set it to "0".

If you are writing your own EA then take that into account.

Do you mean in "input parameters" or is some defined implicit parameters somewhere ? I didn't set none "external" input parameters when started to create my EAs. And how i can find and change it?

 
OrderSend - Trade Functions - MQL4 Reference
OrderSend - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderSend - Trade Functions - MQL4 Reference
 
Dario Capasso #: Do you mean in "input parameters" or is some defined implicit parameters somewhere ? I didn't set none "external" input parameters when started to create my EAs. And how i can find and change it?
When an order is placed, one of the required parameters is the "magic number". That parameter can be set with a constant value, but it is best for it to be set from an "input" parameter for the EA's properties.
 

This is the MQL5 section. You provided a link to the MQL4 function, which is not relevant.

 
Fernando Carreiro #:
When an order is placed, one of the required parameters is the "magic number". That parameter can be set with a constant value, but it is best for it to be set from an "input" parameter for the EA's properties.

no, I usually use this :

#include <Trade\Trade.mqh>




//on tick

bool  Buy(
   double        volume,          // volum
   const string  symbol=NULL,     // symbol
   double        price=0.0,       // price
   double        sl=0.0,          // price stop loss
   double        tp=0.0,          // price take profit
   const string  comment=""       // comment

//called with trade.buy(.....)

And works, dont require magic number

 
Dario Capasso #:no, I usually use this : And works, dont require magic number

Don't just do things without fully understanding them ... Documentation on MQL5: Standard Library / Trade Classes / CTrade / SetExpertMagicNumber

Reason: