EAs are run independently of each other. If you don't want them to collide, then you can make use of a "magic number" on orders so that they only carry out trade operations on their own set.
If your Closing EA is ignoring magic numbers and simply closing all positions irrespectively, then it will collide with other EAs that are monitoring their own trades and try to restabilise them if they are programmed to do so. Those other EAs will also not know if you want to stop trading after all positions are closed and will just continue to work as usual.
Also, each EA is run on a different chart (even if it is on the same symbol) and will have their own independent OnTick() and OnTimer() handlers. Those handlers are not shared among the EAs. Each EA has its own event handler.
Aah.. OK thanks - i confused 'dropped ticks when an EA has not finished with its OnTick() program execution', with 'only 1 EA running at any one time'. The latter is not true and they are clearly two different things. I guess i need to set a GlobalVariable preventing any EA to open any positions when the 'closing program' is executing.
thanks again!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
And at the same time have many EAs on as many Instruments, that Open positions at the same time like:
OnTick() { If(No_open_positions){ If(Some_Indicator>certain_value){ Open_a_Position with certain MagicNumber}}}
Then can someone explain to my how the second EA is opening positions while the first EA is in the process of closing?
I thought that when one EA is executing, other EAs have to wait before it is finished.
Does the OnTick() vs OnTimer() have something to do with it?