ChartRedraw(0) not working

 

I am updating Rates to chart

            MqlRates   rates[  1  ];  
rates [ 0 ] .open = GetRatesOpen (); 
rates [ 0 ] .high = GetRatesHigh (); 
rates[ 0 ].low  = GetRatesLow();  
rates [ 0 ] .close = GetRatesClose (); 


CustomRatesReplace  (  _Symbol  ,rates[  0  ].time,rates[  0  ].time,rates);  

I am using CustomRatesReplace to update chart in real time but i am facing two issues:

1. prev_calculated always returns to zero

2. ChartRedraw(0) not refreshing chart


Any help regarding how to make these would, will be very helpful

Thanks

 
Dark Ryd3r:

I am updating Rates to chart

I am using CustomRatesReplace to update chart in real time but i am facing two issues:

1. prev_calculated always returns to zero

2. ChartRedraw(0) not refreshing chart


Any help regarding how to make these would, will be very helpful

Thanks

I am using following method to refresh chart every time when a new candle closes, but looking forward if its possible to get prev_calculated working

 
 

 int  num =  iBarShift ( NULL , PERIOD_M1 , TimeGMT ()- PeriodSeconds ( PERIOD_M1 ), false ); 
  if (num!= 1 ) { 
  ChartSetSymbolPeriod  ( 0 , _Symbol , _Period ); 
  }  
 

probably your indicator is being stopped. constantly check the stopping flag

   if(IsStopped())