Strange bug: EA works correctly attached to a single chart, mess up things attached to multiple chart ?!

 
Hi all, I wrote a EA which facilitate live trading operations, and it works correctly when attached to a single symbol chart, but mess up thins when attached to multiple syble charts. What I mean is: when attached to multiple charts, EA ( upon input from the trader ) opens a trade operation on a symbol chart, then some operation are executed by same EA attached to DIFFERENT symbol charts, such as execution of a custom Inform() function which prints some text on the chart window, text which contains the number of the order opened in the first chart. Now I really cannot understand why and how is even possible that an EA attached to a chart will pass a parameter ( like the order ticket ) to an EA attached to a DIFFERENT chart, since this EA does not use GlobalVariables of the Client Terminal. How is that possible? How can an EA trigger the execution of functions and pass parameters to an EA attached to a different chart?
 
Do you select orders by Magic Number and Symbol ? or just by Magic Number ?
 

Hi,

EA selects order based on order # ( ticket ) only, for it opens an order upon input form the trader ( there's a line on the chart, moving that line commands the EA to open an order ) and it gets the order # ( ticket ).

After that, order will be selected by ticket when needed ( EA will modify order putting stops, trailing stop, moving stop to break even, etc ).

 
LeveragedJoe:

After that, order will be selected by ticket when needed ( EA will modify order putting stops, trailing stop, moving stop to break even, etc ).

If the EA is restarted how does it pick up from where it left off ? how does it find it's order ?
 

Actually it won't pick up anything: this is a feature I have not yet implemented, EA is still in development stage.

So as it is now, EA simply won't find its order.

 
LeveragedJoe:
How can an EA trigger the execution of functions and pass parameters to an EA attached to a different chart?
I don't believe it can, I think you need to show it doing this in the logs and show your code if you want more specific help rather than best guesses.
 
LeveragedJoe:
Hi all, I wrote a EA which facilitate live trading operations, and it works correctly when attached to a single symbol chart, but mess up thins when attached to multiple syble charts. What I mean is: when attached to multiple charts, EA ( upon input from the trader ) opens a trade operation on a symbol chart, then some operation are executed by same EA attached to DIFFERENT symbol charts, such as execution of a custom Inform() function which prints some text on the chart window, text which contains the number of the order opened in the first chart. Now I really cannot understand why and how is even possible that an EA attached to a chart will pass a parameter ( like the order ticket ) to an EA attached to a DIFFERENT chart, since this EA does not use GlobalVariables of the Client Terminal. How is that possible? How can an EA trigger the execution of functions and pass parameters to an EA attached to a different chart?
Have you ever heard about MagicNumber? It's same as ID, so each EA launched must have different number. Magics like "2", "3", "4" etc.
 
26994:
Have you ever heard about MagicNumber? It's same as ID, so each EA launched must have different number. Magics like "2", "3", "4" etc.
No they don't.
 

Hi RaptorUK, the EA is a modified version of vHandsTrade.mq4 which you can find here:

https://www.mql5.com/en/articles/1425

now vHandsTrade is written to manage trades in tester mode, but it is sufficient to comment this line in the EA code:

if ( !IsTesting() ) { Alert( "vHandsTrade: ñîâåòíèê ïðåäíàçíà÷åí òîëüêî äëÿ òåñòèðîâàíèÿ!" ); error = true; return(-1); }

putting a double slash ( // ) at the beginning, compile it and this can be used in live trading

now if you open four live charts, like EURUSD, USDCHF, AUDUSD and GBPUSD, attach the EA on each on them, and open a BUY order for EURUSD by moving the corresponding line on the chart, you'll see that an information text will appear on EURUSD chart on the top left side. This is custom function MultiComment() which is being executed.

BUT, after a short while, information texts will appear on each of the remaining charts ( U/C A/U and G/U ), meaning that an action on the EA attached the EURUSD triggered more actions on EAs attached to DIFFERENT charts.

Don't look at the text, which doesn't make sense for it is originally a russian script, but please let me know how it is even possible than an EA will trigger the execution of some code of EAs attached to DIFFERENT charts? I can fix bugs by myself but, really, I am confused and puzzled about an EA messing up with EAs on different charts !!!

 
No mind readers here - post your code.
Reason: