Link opened charts timeframes

Frédéric LEBRE  

Hi,

Please, i need help, i searched but did not find.


I have 2 opened charts on MT5.


When i change the timeframe on the first one, i would like the sesond chart to change to same timeframe.

Can not find command for this.


Thx for your answers.

Tobias Christian Witzigmann  

You are welcome ;D

// link charts

   if(m_linkCharts){
      long chartID=ChartFirst();
      while (chartID>0){
         if(chartID!=ChartID()){
            if(ChartPeriod(chartID)!=ChartPeriod(NULL)){
               ChartSetSymbolPeriod(chartID,ChartSymbol(chartID),PERIOD_CURRENT);
            }
            ChartSetInteger(chartID,CHART_SCALE,ChartGetInteger(NULL,CHART_SCALE));   
            int firstVisibleBar = iBarShift(ChartSymbol(chartID),ChartPeriod(NULL),m_candleTime);
            int totalBars = Bars(ChartSymbol(chartID),ChartPeriod(NULL));
            ChartNavigate(chartID,CHART_BEGIN,(totalBars-firstVisibleBar));
         }
         chartID = ChartNext(chartID); 
      }  
   }
Reason: