How to access arrays on MQL4 articles or sample code

 

Hello,

I am writing a little indicator, I need to create and access and array for bands. I need to compare if the current lower bb is higher than the previous. Here is the code that is giving me the "cannot access array" error message.

double ticksize = MarketInfo(Symbol(),MODE_TICKSIZE);

   if( m_Bars == Bars ) return (rates_total);

   int oldestBar = (m_Bars == 0 ? Bars - 1 : 1);

   m_Bars = Bars;

   for(int i = oldestBar; i > 0; i--)

   {

      double x  = iBands(NULL,0,20,0,0,PRICE_CLOSE,MODE_MAIN,i);

      double y = iBands(NULL,0,20,0.382,0,PRICE_CLOSE,MODE_UPPER,i);

      double z[] = iBands(NULL,0,20,0.382,0,PRICE_CLOSE,MODE_LOWER,i); 

      

      double ma = iMA(NULL,0, 50, 0,MODE_SMA,PRICE_CLOSE , i);

      double ma2 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, i);

      

      

      if( (ma == EMPTY_VALUE) || (ma <= 0.0) ) continue;

      double range = (High[i] - Low[i]);

      if( Close[i] > ma )

      {

         if( z[i] < z [i+1])

         {

            BUY[i] = Low[i] - Gap_Pips * ticksize;

            notifyAlert(i, true);

         }

         }

           

        

         else if( Low[i] > y)

         {

            SELL[i] = High[i] + Gap_Pips * ticksize;         

            notifyAlert(i, true);

         }
Reason: