historical, new and ticks

 

What's the most efficient way to isolate historical bars, new real-time bars and ticks in OnCalculate?

e.g.

   int i, last;

   if(prev_calculated > 1)
      i = prev_calculated - 1;
   else
      i = 0;
      
   last = rates_total - 1;

   if (i == last)
   {
      //tick
   }
   else
   {
      //historical & new bars
      for(; i < rates_total; i++)
      {

      }
   }


 
static datetime tBar =0;
...
if ( tBar != Time[0] ) { 
     tBar  = Time[0];
     ...
} else { // ticks of the recent bar
..
}
You are looking for s.th. like that?
Reason: