How calc just last 100 bars ? please help

 

Hi i have script like this

why it doesnt show up ? and if i put some Print info to debug. it took soooo long to cyclle from first day in history to current day.

i what calculate just current day ..not whole bars in history .Do you have some suggestion how to achieve it ? thanks

//+------------------------------------------------------------------+
//|                                                   FlimboTest.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window

int pocet=0;

 MqlRates weeklyRates[];
 
 MqlDateTime dnesStruc;
 
int i=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
//---




   TimeToStruct(TimeCurrent(),dnesStruc);
   
   return(0);
  }
//+------------------------------------------------------------------+

  
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {

   MqlDateTime terasStruc;
   TimeToStruct(time[0],terasStruc);
   
   if(terasStruc.day==dnesStruc.day && terasStruc.mon==dnesStruc.mon && terasStruc.year==dnesStruc.year){
   
  
      Alert("Today!");
   }

   
   return(rates_total);
  }

//+------------------------------------------------------------------+
 

Use for cycle for last 100 bars. For examples

for (int i=rates_total; i<rates_total; i++)
  {
   indicator_buffer[i]= //  close[i], time[i] etc.
  {

See also Indexing Direction in Arrays, Buffers and Timeseries and article The Principles of Economic Calculation of Indicators


Reason: