Download MetaTrader 5
To add comments, please log in or register
Sell your CPU capacity and earn money!
paul williams
35
paul williams 2014.09.29 06:52 

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++)
      {

      }
   }


Carl Schreiber
5938
Carl Schreiber 2014.09.29 11:20  
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?
/
To add comments, please log in or register