Simple Logic Error

 

I'm programming an indicator to determine the highest high in the past 5 bars. This code just plots a straight line across the chart and I can't figure out why.

See comments in start() for more info.

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue 

double Hi5[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,Hi5);
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int Counted_bars=IndicatorCounted();
   int i;
   i=Bars-Counted_bars-1;           // Index of the first uncounted   
   while(i>=0)                      // Loop for uncounted bars
     {
     
/*     
     This is where the logic error occurs. What I tried to do is
     If current element is null, the element equals current High
     OR
     It should then loop back for the past 5 bars and determine which one was the highest
     Whenever it finds a higher high, it should set the element equal to that high until the loop ends
*/     
         for (int j = 0; j < 5; j++)
         {
            if ( Hi5[i] < High[j] || Hi5[i] == NULL)
               Hi5[i] = High[j];
         }

        i--;                          // Calculating index of the next bar
     }
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+