i'm building ad indicator in mql for mt4
in my mql indicator, i need to get the chart id of all the chart that i opened manually on my mt4
how i can get these id?
- how to open a profile form button click
- how to open a chart from button click
- New Members introduction
Use ChartFirst() and ChartNext() functions to enumerate active charts.
This is sample code from the documentation for the ChartNext():
//--- variables for chart ID long currChart,prevChart=ChartFirst(); int i=0,limit=100; Print("ChartFirst =",ChartSymbol(prevChart)," ID =",prevChart); while(i<limit)// We have certainly not more than 100 open charts { currChart=ChartNext(prevChart); // Get the new chart ID by using the previous chart ID if(currChart<0) break; // Have reached the end of the chart list Print(i,ChartSymbol(currChart)," ID =",currChart); prevChart=currChart;// let's save the current chart ID for the ChartNext() i++;// Do not forget to increase the counter }
Or more simply:
long chartID=ChartFirst(); while(chartID >= 0) { Print(chartID); chartID = ChartNext(chartID); }
it's work!, thx to all!
Thx also to all!!
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