Are you sure about this?
A globally declared array is only global to the instance of the EA. It should not be possible to access that array from the same EA attached to a different chart.
Please note that the function OrderTotal() returns the total number of open orders for the entire account. It has no relationship with the Chart you have the EA running, so it does not filter by Currency pair or by Time-frame or by Magic number or anything else for that matter. It is simply the Total number of open orders for the entire account for all the running EAs as well as manual trades.
But I did it for try to explain my topic, in few words, I need create an array for every pair when the EA is running so the data not mixed
The Data does not "mix". You must be doing something wrong, so show your real code if you want us to help!
To add samples don't use screen-shots; use the SRC button in the toolbar:
If the code is long, then attach it instead (in the bottom-left):
I have a problem... I declared an array outside any function, so, the scope of this array is global.
Execute the EA and I save and load data from this array on a pair, for example EURUSD without problems but, the problem is when I execute the same Expert Advisor on 2 or more pairs, the data is combined and I don't know if the data that I´m getting is from EURUSD, GBPUSD or another one, what can I do?
Beforehand, thank you.
Yes, by learning to code properly. Don't assign "data" to variable names. Assign data to the storage of the variables, not their names.
Create a structure for storing the data, including the symbol names, price, etc., then create an array of the structure.
You can also adopt OOP programming and use classes for more sophisticated needs.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a problem... I declared an array outside any function, so, the scope of this array is global.
Execute the EA and I save and load data from this array on a pair, for example EURUSD without problems but, the problem is when I execute the same Expert Advisor on 2 or more pairs, the data is combined and I don't know if the data that I´m getting is from EURUSD, GBPUSD or another one, what can I do?
Beforehand, thank you.