请问:如何让指标在近十根K线内出现过一次信号,那就不再重复出现。以下是我的一下尝试,但是行不通

 
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Chartreuse
#property indicator_color2 Orange

//--- indicator buffers
double         均线Buffer[];
double         上箭头Buffer[];
int OnInit()
  {
  
   SetIndexBuffer(0,均线Buffer);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,clrPink);
   SetIndexLabel(0,"均线");
   SetIndexBuffer(1,上箭头Buffer);
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1,clrRed);
   SetIndexLabel(1,"上箭头");
   SetIndexArrow(1,225);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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=0;
   int limit;
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)limit++;
    /*
   int bars = 20; //20个K先内
   int shift = GetCCIMax(bars);//20个K线内,CCI最大的那个K线的索引
   //
   shift = GetCCIMin(bars); //20个K线内,CCI最小的那个K线的索引
   */
   int shift = 0;
   for(int i=0;i<bars+5 && i<Bars+5; i++)
    {
     double v=上箭头Buffer[i];
     if( v>0  )
      {
        shift = i;
      }
    }
   for(i=0;i<limit;i++)
    {
      if( Close[0]>平均收盘价 && shift>bars  )
       {
         上箭头Buffer[i]=High[i];
       }

    }

//--- return value of prev_calculate
   return(rates_total);
  }
//+------------------------------------------------------------------+

int GetCCIMax(int bars)
{
   int shift = 0;
   for(int i=0;i<bars+5 && i<Bars+5; i++)
    {
     double v=上箭头Buffer[i];
     if( v>0  )
      {
        shift = i;
      }
    }
   return(shift);
}