some error about code

 

the code for an Indicator

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow // High Points Array Line

extern int Seek_Period=30;
double Bar_High[];


int init()
  {
  IndicatorShortName("High_Low_Two_Lines");
  IndicatorBuffers(1);
  SetIndexBuffer(0,Bar_High);
  SetIndexStyle(0,DRAW_LINE);
  SetIndexLabel(0,"High Point Line");
  SetIndexDrawBegin(0,0);
  return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int    counted_bars=IndicatorCounted();
   int i=Seek_Period,i_0;
   while(i>6)
   {
     i_0=iHighest(NULL,0,MODE_HIGH,i,3); // set 3 to ensure left trade
   if(i_0>=5&&iHighest(NULL,0,MODE_HIGH,i_0+5,i_0-5)<High[i_0]&&Bar_High[0]!=High[i_0])
     {  
        Bar_High[0]=High[i_0];
          break;
     }

     i--;
   }
   return(0);
  }

the code for EA to call the Indicator by iCustom()

double x;
int start()
  {

double y[9];
int i=0;
while(i<9)
{
y[i]=iCustom(NULL,0,"High_Low_Ind",30,0,i); 
i++;
}

if(x!=y[0])
{
x=y[0];
Print("y[0-8]:",y[0]," , ",y[1]," , ",y[2]," , ",y[3]," , ",y[4]," , ",y[5]," , ",y[6]," , ",y[7]," , ",y[8]);
}
   return(0);
  }
  

The result is

2013.12.02 14:31:39 2013.11.28 23:55 aTestEA USDJPY,M5: y[0-8]:2147483647, 102.286, 102.286, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:39 2013.11.28 23:45 aTestEA USDJPY,M5: y[0-8]:102.286, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 102.257, 102.257

2013.12.02 14:31:39 2013.11.28 23:15 aTestEA USDJPY,M5: y[0-8]:2147483647, 102.257, 102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:09 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:08 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:08 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:08 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:08 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294

2013.12.02 14:31:39 2013.11.28 23:08 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.256, 102.257, 102.257, 102.257, 102.294, 102.257, 102.294


..........

2013.12.02 14:31:39 2013.11.28 22:49 aTestEA USDJPY,M5: y[0-8]:102.257, 102.257, 102.294, 102.257, 102.294, 102.294, 102.294, 102.294, 102.294

2013.12.02 14:31:39 2013.11.28 22:48 aTestEA USDJPY,M5: y[0-8]:102.256, 102.257, 102.294, 102.257, 102.294, 102.294, 102.294, 102.294, 102.294

2013.12.02 14:31:35 2013.11.28 00:02 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:02 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:01 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:35 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.174, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 aTestEA USDJPY,M5: y[0-8]:102.18, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647

2013.12.02 14:31:34 2013.11.28 00:00 High_Low_Ind USDJPY,M5: loaded successfully

I can't understand the result as below:

1. the second line(from bottom), when the new price coming, array Bar_High[0] gets the new price and Bar_High[1] will get Bar_High[0]'s previous value, but in the result not,why?

2. how does the big value "2147483647" come again at the very top lines?

I think there is still something which I don't understand about indicator buffer array, but I don;t know exactly, that is why i post this .


 
See documentation for EMPTY_VALUE and check you indicator code when your condition is false.