Critical Error : Array out of range

 

Hello, 

I have some issues regarding 2 array for storing horizontal lines. This is the code, it shows  Trendline EA 1.4 EURUSD,M15: array out of range in 'Trendline EA 1.4.mq4' (108,50).


   int linB=0,linS=0,B=0,S=0;

   for(int i=0;i<ObjectsTotal();i++)
     {
      objectname=ObjectName(ChartID(),i);     
      if(ObjectType(objectname)==OBJ_HLINE)
        {
         if(Close[0]<ObjectGet(objectname,OBJPROP_PRICE1))
          {
          linB++;
          ArrayResize(hlineBuy,linB);        
          hlineBuy[B]= ObjectGet(objectname,OBJPROP_PRICE1);
          B++;
          }
         if(Close[0]>ObjectGet(objectname,OBJPROP_PRICE1))
          {
          linS++;
          ArrayResize(hlineSell,linS);        
          hlineSell[S]= ObjectGet(objectname,OBJPROP_PRICE1);
          S++;
          }          
        }
  }
 
one questions : how to obtain 12 freelance finished projects and not knowns about arrays ?
 
Maxim Kuznetsov:
one questions : how to obtain 12 freelance finished projects and not knowns about arrays ?
Well I didn’t have any problems with arrays then, but this case is specific 
 

You know where the error is

" Trendline EA 1.4 EURUSD,M15: array out of range in 'Trendline EA 1.4.mq4' (108,50)."

so look at line 108 and maybe highlight it if so that others also know where it is, if you want them to help you.

 
 for(int l=0;l<linB;l++)
   {
        for( int i=0;i<linS;i++)
     {
      if(hlineBuy[l]+offset*point<Close[0] && hlineBuy[l]+offset*point>Open[0] && hlineBuy[l]>0)
        {
         buyHLA=true;
         break;
        }        
       else if( hlineSell[i]-offset*point>Close[0] && hlineSell[i]-offset*point<Open[0] && hlineSell[i]>0) // This is line 108
        {
         sellHLB=true;
         break;
        }        
      else buyHLA=false;sellHLB=false;
     }
     }
 
Actually, By knowing that I fixed it, Thank you very much