这个指标为什么会让平台死机啊?

 

我用的这个指标,在开市的时间段里,使用在AUDUSD 1M 的时候会让平台死机,而用在其它货币对或时期就没有这个问题。

在休市的时间段里就没有任何问题,这是怎么回事?

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Aqua
#property indicator_color3 Red
//---- input parameters
int    periods,Ha,Hb,Hc;
double top[],middle[],base[],aa[],RP[],ZZ[],ZH[],Grd[];
double turn0,turn0t,turn0b,turn1,turn2,turn3;
double co=2.618,cof;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexBuffer(0,top);
   SetIndexBuffer(1,middle);
   SetIndexBuffer(2,base);
   SetIndexBuffer(3,aa);
   SetIndexBuffer(4,RP);
   SetIndexBuffer(5,ZZ);
   SetIndexBuffer(6,ZH);
   SetIndexBuffer(7,Grd);
//----
   periods=120;Ha=1;Hb=6;Hc=16;
   if (Close[Bars-2]>50) cof=100;
   else cof=10000;
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i,j;
   co=2.618;
   GetRefPrice(Ha,cof);
   for (i=Bars-1;i>=0;i--) aa[i]=MathAbs(RP[i]-RP[i+Ha]);
   for (i=Bars-1;i>=0;i--) Grd[i]=1.618+cof*iMAOnArray(aa,0,periods*Ha,0,MODE_SMA,i);
   GetZZ(RP,Grd,co,cof);GetGZH(ZZ,RP,Grd,co);
   for (i=Bars-1;i>=0;i--) top[i]=ZH[i];
   GetRefPrice(Hb,cof);
   for (i=Bars-1;i>=0;i--) aa[i]=MathAbs(RP[i]-RP[i+Hb]);
   for (i=Bars-1;i>=0;i--) Grd[i]=1.618+cof*iMAOnArray(aa,0,periods*Hb,0,MODE_SMA,i);
   GetZZ(RP,Grd,co,cof);GetGZH(ZZ,RP,Grd,co);
   for (i=Bars-1;i>=0;i--) middle[i]=ZH[i];
   GetRefPrice(Hc,cof);
   for (i=Bars-1;i>=0;i--) aa[i]=MathAbs(RP[i]-RP[i+Hc]);
   for (i=Bars-1;i>=0;i--) Grd[i]=1.618+cof*iMAOnArray(aa,0,periods*Hc,0,MODE_SMA,i);
   GetZZ(RP,Grd,co,cof);GetGZH(ZZ,RP,Grd,co);
   for (i=Bars-1;i>=0;i--) base[i]=ZH[i];
//----
   return(0);
  }
//+++-----------------------------------------------------------------------------+++
double GetRefPrice(int H,double Refcof)
  {
   int i,j;
   double m,n,na;
   .
   .
   .
   
   return (RP);
  }
//+++-----------------------------------------------------------------------------+++
double GetZZ(double RefPrice[],double RefGrd[],double Refco,double Refcof)
  {
   int i,j,dir;
   int tpos1,tpos2,tpos0t,tpos0b;
   double turn1,turn0t,turn0b;
   .
   .
   .
   return (ZZ);
  }
//+++-------------------------------------------------------------------------------+++
double GetGZH(double RefZZ[],double RefPrice[],double RefGrd[],double Refco)
  {
   int i,j,Z1,Z2,Z3;
   int tpos2,tpos3,tpos0t,tpos0b;
   double turn0t,turn0b;
   double t02,t02a,t03,t03a;
   double m;
   .
   .
   .
   
   return (ZH);
  }
原因: