Close-All-Charts-Except-Actual

Author: Copyright 2021, Thomas Nowotny
Miscellaneous
It opens Message Boxes to the user
0 Views
0 Downloads
0 Favorites
Close-All-Charts-Except-Actual
ÿþ//+------------------------------------------------------------------+

//|                               Close-All-Charts-Except-Actual.mq5 |

//|                                                   Thomas Nowotny |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright     "Copyright 2021, Thomas Nowotny"

#property version       "1.00"

#property description   "\n\nCloses all open charts, except the actual one."



//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart(){

   

   int retMsgBox = MessageBox("Close all charts, except the actual one?"," Attention",MB_YESNOCANCEL);

   

   if(retMsgBox == 6){

      //--- loop over open charts

      for(long chartIdentNr=ChartFirst(); chartIdentNr != -1; chartIdentNr=ChartNext(chartIdentNr)){

         //--- if chartIdentNr doesnt fit to the selected chart --> close

         if(chartIdentNr != ChartID()) ChartClose(chartIdentNr);

      }

   }

}

//+------------------------------------------------------------------+

Comments