Indicator not updating, please help to solve this

 
Hey everyone, I have some problem after compiling with (#property strict).
Without it the indicator works fine, after using (#property strict), the indicator stops to update.

Please help to solve and thank you.

//+------------------------------------------------------------------+
#property version "1.0"
//#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 clrSteelBlue
#property indicator_color2 clrMediumSeaGreen
#property indicator_color3 clrCrimson
#property indicator_color4 clrCrimson
#property indicator_width1 1
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 1
double draw_up_arrow_on_fast[];
double draw_down_arrow_on_fast[];
double ma_blue_aray[];
double ma_red_aray[];
//+------------------------------------------------------------------+
extern int drawCandlesBack=10000;
extern int MaBluePeriod=20;
extern int MaRedPeriod=100;
extern int MaMethod=0;
extern int arrowDST=100;
extern bool alert=false;
extern string up="up Arrow";
extern string down="down Arrow";
extern int upArrowCode=241;
extern int downArrowCode=242;
int limit;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,ma_blue_aray);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,MaBluePeriod);

   SetIndexBuffer(1,draw_up_arrow_on_fast);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,upArrowCode);
   SetIndexLabel(1,"UP");

   SetIndexBuffer(2,draw_down_arrow_on_fast);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,downArrowCode);
   SetIndexLabel(2,"DOWN");

   SetIndexBuffer(3,ma_red_aray);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexDrawBegin(3,MaRedPeriod);

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
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[])
  {
   limit=MathMax(rates_total-prev_calculated,2);
   
   drawMAs();
   drawArrows();

   return(rates_total);
  }
//+------------------------------------------------------------------+
bool newcandle()
  {
   static datetime saved_candle_time;
   if(Time[0]==saved_candle_time)
      return false;
   else saved_candle_time=Time[0];
   return true;
  }
//+------------------------------------------------------------------+
void drawMAs()
  {
   for(int i=1; i<limit; i++)
     {
      double maRed=iMA(NULL,0,MaRedPeriod,0,MaMethod,PRICE_CLOSE,i);
      double maBlue=iMA(NULL,0,MaBluePeriod,0,MaMethod,PRICE_CLOSE,i);

      ma_red_aray[i]=maRed;
      ma_blue_aray[i]=maBlue;
     }
  }
//+------------------------------------------------------------------+
void drawArrows()
  {
   for(int i=1; i<limit; i++)
     {
      double body3=MathAbs(Open[i+2]-Close[i+2]);
      double body3mid_point=MathAbs(Close[i+2]+(Open[i+2]-Close[i+2])/2);
      double body2=MathAbs(Open[i+1]-Close[i+1]);

      if((
         body2<body3 && 
         Close[i]>Open[i+2] && 
         Close[i]>Close[i+2] && 
         Open[i+1]>ma_blue_aray[i] && 
         Close[i+1]>ma_blue_aray[i] && 
         Open[i+2]>ma_blue_aray[i] && 
         Close[i+2]>ma_blue_aray[i] && 
         Low[i+1]<=ma_blue_aray[i] && 
         High[i]<ma_red_aray[i]
         )
         || 
         (
         Close[i]>High[i+2] && 
         Close[i]>Open[i+1] && 
         Close[i]>Close[i+1] && 
         Open[i+1]>ma_blue_aray[i] && 
         Close[i+1]>ma_blue_aray[i] && 
         Open[i+2]>ma_blue_aray[i] && 
         Close[i+2]>ma_blue_aray[i] && 
         Low[i]<=ma_blue_aray[i] && 
         High[i]<ma_red_aray[i]
         ))
        {
         draw_up_arrow_on_fast[i+1]=Low[i+1]-arrowDST*Point;

         if(alert==true)
            Alert(up," ",Symbol()," ",Period(),"m");
        }

      if((
         body2<body3 && 
         Close[i]<Open[i+2] && 
         Close[i]<Close[i+2] && 
         Open[i+1]<ma_blue_aray[i] && 
         Close[i+1]<ma_blue_aray[i] && 
         Open[i+2]<ma_blue_aray[i] && 
         Close[i+2]<ma_blue_aray[i] && 
         High[i+1]>=ma_blue_aray[i] && 
         Low[i]>ma_red_aray[i]
         )
         || 
         (
         Close[i]<Low[i+2] && 
         Close[i]<Open[i+1] && 
         Close[i]<Close[i+1] && 
         Open[i+1]<ma_blue_aray[i] && 
         Close[i+1]<ma_blue_aray[i] && 
         Open[i+2]<ma_blue_aray[i] && 
         Close[i+2]<ma_blue_aray[i] && 
         High[i]>=ma_blue_aray[i] && 
         Low[i]>ma_red_aray[i]
         ))
        {
         draw_down_arrow_on_fast[i+1]=High[i+1]+arrowDST*Point;

         if(alert==true)
            Alert(down," ",Symbol()," ",Period(),"m");
        }
     }
  }
//+------------------------------------------------------------------+
 

Looks like i+2 goes beyond the array bounds. Try:

limit=MathMax(rates_total-prev_calculated-2,2);
 
lippmaje:

Looks like i+2 goes beyond the array bounds. Try:

Thanks a lot, it worked partially. The MA's updating but i can't see the arrows now :)

i'll try to figure it up..

Reason: