Closing graphs

 
Hi; anyone know how close all graphs at same time? tks
 

For MT4: Close the program and navigate to the folder profiles - default and there you delete all .chr files located in it.

For MT5 the folder is MQL5 - Profiles - Charts - Default.

 
Jhennifher:
Hi; anyone know how close all graphs at same time? tks
Keep pressing on CTRL-W.
 
Jhennifher :
Hi; anyone know how close all graphs at same time? tks

Try this code:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   long chart_id=ChartID();
//--- variables for chart ID
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   if(prevChart!=chart_id)
      ChartClose(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
      prevChart=currChart;             // let's save the current chart ID for the ChartNext()
      i++;                             // Do not forget to increase the counter
      if(currChart!=chart_id)
         ChartClose(currChart);
     }
   ChartClose(chart_id);
  }
 
lippmaje:

For MT4: Close the program and navigate to the folder profiles - default and there you delete all .chr files located in it.

For MT5 the folder is MQL5 - Profiles - Charts - Default.

tks

 
Alain Verleyen:
Keep pressing on CTRL-W.

tks

 
Владимир Карпутов :

Попробуйте этот код:

It really worked; TCS a lot Vladimir.

 
Vladimir Karputov #:

Try this code:

Hi, thank you for guiding, i appreciate if you help me to know how to change code for closing all charts, except the chart that expret is run on it?

 
337252 # :

Hi, thank you for guiding, i appreciate if you help me to know how to change code for closing all charts, except the chart that expret is run on it?

Explore the Chart Operations Help topic

Documentation on MQL5: Chart Operations
Documentation on MQL5: Chart Operations
  • www.mql5.com
Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: