mt5重新启动后指标会自动退出,不知道为什么?

 

哪位大神看看,指标加载没问题,只要mt5 重新启动等价格波动时候就自动退出,只能重新加载,不敢重启

#property version   "1.000"

#property description "Fractals at prices Close"
#property indicator_chart_window//指标应用在主窗口
#property indicator_buffers 1//指标需要缓冲区数量
#property indicator_plots   1//指标需要画几条线
#property indicator_label1  "up"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  DarkBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
double  up[];
int     f1=18,count=18;
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,up,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_ARROW,119);
   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,-10);
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+  
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int i,limit;
   if(rates_total<8) return(0);//图表数据小于8退出
   if(prev_calculated==0)
     limit=100;
   else limit=prev_calculated;
   for(i=limit;i<rates_total && !IsStopped();i++)
     {
        
       setfg(i);
       up[f1]=high[f1];
       }

   return(rates_total);
  }
void setfg( const int i)
{
if (i>100)
{
f1 = i;
}
}