multiple instances

 
I just had a quick question: when running multiple instances of MetaTrader, will the functions within an EA only work on that instance? For example, if I have two positions open (with two different pairs) and I have an EA that will close them when the Accountprofit() reaches "x", will that only close the open positions within that instance or will it look at ANY positions on the account and close them? Any help would be greatly appreciated! If it hits the whole account, is there a way around that? Thanks everyone!! Daniel
 
it will always *see* all positions on the account. It is up to the script or EA to decide which ones to close. Therefore things like the magic number exist to be able to tag orders that belong together with a certain number so your EA can later easily find them and ignore all others. You have to explicitely program this into your script or EA yourself (MQL4 has no ready-to-use functions for that, but it is quite easy to implement) or use one of the 3rd party libraries (like the common_functions.mqh) that provide easy to use functions for things like that.
Reason: