Why is this out of range????

Arthur Singer
1067
Arthur Singer  
for(int i=0;i<rates_total;i++)
   {
      double Buffer=iCustom(_Symbol,_Period,"SuperTrendValues",0,i+1);
      double Buffer_1=iCustom(_Symbol,_Period,"SuperTrendValues",0,i+2);
      
      if(Buffer>Buffer_1)
      {
         Blue_1=true;
         Red_1=false;
      }
      if(Buffer<Buffer_1)
      {
         Blue_1=false;
         Red_1=true;
      }
      
      if(Blue_1==true)
      {
         TrendUp[i+1]=Buffer; // <--- ARRAY OUT OF RANGE
      }
      if(Red_1==true)
      {
         TrendDown[i+1]=Buffer;
      }
   }
   
   return(rates_total);
Lorentzos Roussos
25025
Lorentzos Roussos  
Arthur Singer:

go up to <rates_total-1

Arthur Singer
1067
Arthur Singer  
Thank you very much!
William Roeder
24261
William Roeder  
         TrendDown[i+1]=Buffer;

          How to do your lookbacks correctly #9 - #14 & #19