Yes please see: https://www.mql5.com/en/docs/globals
![Documentation on MQL5: Global Variables of the Terminal Documentation on MQL5: Global Variables of the Terminal](/i/community/logo_mql5_small.png)
Documentation on MQL5: Global Variables of the Terminal
- www.mql5.com
Global Variables of the Terminal - Reference on algorithmic/automated trading language for MetaTrader 5
Do you use a magic number to differentiate between the EA instances?
Daniel Castro:
...
Yes, fix the bug(s).
...
Is there any code practice to avoid that?
Drazen Penic: Do you use a magic number to differentiate between the EA instances?
| Exactly. Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum |
Drazen Penic:
Do you use a magic number to differentiate between the EA instances?
Do you use a magic number to differentiate between the EA instances?
This was my first guess, but I was considering that could be a different approach to promote this kind of isolation between the running EAs.
Of course there are many.
You could write a book about this subject alone.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys,
I am trying to write a EA that can be attached to multiple Charts.
My first try on Demo Account showed me that when I attach the EA on two pairs I get the values of my inputs variables shared among the 2 running EA.
For example:
I have a EA that defines the maximum number of open orders for this EA attached to the pair USDCHF
input int max_orders = 3;
When I attach the same EA to the USDJPY chart I also define the max_order for this instance to be 3.
What I would like to see happening is a total of 6 opened orders because it works as a grid EA. But what I observed is that I get 2 orders for USDCHF and one for USDJPY.
Is there any code practice to avoid that?