Is there a way to automatically close and open all charts using MQL4?
Search for Post Message
Sorry, that does not help. I cannot find anything searching for "Post Message" that would tell me how to open or close charts.
hknight:
Sorry, that does not help. I cannot find anything searching for "Post Message" that would tell me how to open or close charts.
Sorry, that does not help. I cannot find anything searching for "Post Message" that would tell me how to open or close charts.
This is what WHRoeder meant https://www.mql5.com/en/forum/124688, specifically message
#define MT4_WMCMD_57602 57602 /* close the current chart */
But I couldn't find to open a chart :(
hknight:
Is there a way to automatically close and open all charts using MQL4?
Is there a way to automatically close and open all charts using MQL4?
I have the same problem, too. I try to use ChartClose()/ChartNext(), etc. to do so, but there are some problem .... What's wrong with it?
void CloseAllCharts() { long curChart,prevChart=ChartFirst(); int i=0,limit=100;//limit is the maximum numbrt that might open in the terminal. //Print("ChartFirst =",ChartSymbol(prevChart),"ChartPeriod=",ChartPeriod(prevChart)," ID =",prevChart); while(i<limit){ curChart=ChartNext(prevChart); // Get the new chart ID by using the previous chart ID if(curChart==-1)break; //Print("ChartCurrent =",ChartSymbol(curChart),"ChartPeriod=",ChartPeriod(curChart)," ID =",curChart); bool ret=ChartClose(prevChart); if(!ret){ Alert("chart close failed, #",GetLastError()); Print(i,ChartSymbol(curChart)," ID =",curChart); } else prevChart=curChart;// let's save the current chart ID for the ChartNext() i++;// Do not forget to increase the counter } }
tzm:
It seems to work, what's your problem ?
I have the same problem, too. I try to use ChartClose()/ChartNext(), etc. to do so, but there are some problem .... What's wrong with it?

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