MT5 Refresh all open charts

 

Hi,

i try a refresh for all my open charts, i.e. have 4 EUSUSD charts open: H4, H1, M30, M15.

But after running the script 

void OnStart()

{

   long id=ChartNext(0);

   while(id>=0)

   {

      if(!ChartSetSymbolPeriod(id,NULL,0))

         Print(__FUNCTION__+" ChartSetSymbolPeriod ",ErrorDescription(GetLastError())); 

 

      id = ChartNext(id);

   }

}

all charts have same Time-Period, i.e. M30.

How can I achieve that the period for every chart stays as it was?

Thx a lot!

 
The most interesting question: "Why ???". Why try to "refresh" charts? The charts work independently and are independently updated (receive price data).
 
Because i have an indicator which does not always display correctly when starting a chart.
 
WeHu58 :
Because i have an indicator which does not always display correctly when starting a chart.

In such a situation, the correct step is to fix the indicator!

 
Vladimir Karputov:

In such a situation, the correct step is to fix the indicator!

Can not, have only the .ex5 file

 
WeHu58:

Hi,

i try a refresh for all my open charts, i.e. have 4 EUSUSD charts open: H4, H1, M30, M15.

But after running the script 

all charts have same Time-Period, i.e. M30.

How can I achieve that the period for every chart stays as it was?

Thx a lot!

Just read the documentation of ChartSetSymbolPeriod() and you will have your answer.
Reason: