代码运行结果出问题,请教指点

 
#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])

     {  
       if(Bar_High[0]!=High[i_0])
       Bar_High[0]=High[i_0];
          break;
     }

     i--;
   }
   return(0);
  }
以上是MT4中的一个自定义指标,然后在EA中用iCustom()函数调用,然后print出Bar_High数组中的值
double y,x,z;

x=iCustom(NULL,0,"High_Low_Ind",30,40,50,0,0); 
y=iCustom(NULL,0,"High_Low_Ind",30,40,50,0,1); 
z=iCustom(NULL,0,"High_Low_Ind",30,40,50,0,2);
 if(x_0!=x)
 {
  Print("x_0, y_1, z_2 : ", x," , ",y," , ",z);
  x_0=x;
  }
 
其print的结果如图:

问题是,一开始y_1和z_2等于2147483647可以理解,但是后来又恢复这么大的数,不知道什么问题,而且好像y_1和z_2值一直是一样的,但是实际是两者分别代表的是数组中第2位和第3位的值
 

MT4中的一个自定义指标???

这样的指标不规范, 要么改变算法对Bar_High[ i ]赋值, 

要么在init中加ArrayInitialize(Bar_High,EMPTY_VALUE);或ArrayInitialize(Bar_High,0);

 
谢谢!
原因: