Malacarne:
I have searched the docs, but couldn't find any specific function to count the number of opened charts on MT5 terminal.
To solve this problem I came up with this solution:
However, I don't know if this is the best approach, once I'm not sure if such a feature already exists as a built-in function...
Does anybody know if this feature actually exists?
ChartFirst() and ChartNext() return a long, why are you using a string array to save these values ?
int chartCount=0; long prevChart=ChartFirst(); while(prevChart!=-1) { prevChart=ChartNext(prevChart); chartCount++; } Print("Number of charts = ", chartCount);
I don't think there is a built-in function for that.
angevoyageur:
Hi angevoyageur,ChartFirst() and ChartNext() return a long, why are you using a string array to save these values ?
I don't think there is a built-in function for that.
Thanks for the reply. I'm actually using the long values as an input inside an Expert Advisor. Anyway, I wanted to find a better way to count the opened charts, and your code works perfectly! Thanks
Documentation on MQL5: Chart Operations / ChartOpen
- www.mql5.com
Chart Operations / ChartOpen - Documentation on MQL5
Malacarne:
Hi angevoyageur,
You are welcome.
Hi angevoyageur,
Thanks for the reply. I'm actually using the long values as an input inside an Expert Advisor. Anyway, I wanted to find a better way to count the opened charts, and your code works perfectly! Thanks
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
I have searched the docs, but couldn't find any specific function to count the number of opened charts on MT5 terminal.
To solve this problem I came up with this solution:
However, I don't know if this is the best approach, once I'm not sure if such a feature already exists as a built-in function...
Does anybody know if this feature actually exists?