SendNotification sends multiple and old alerts. How to handle?

 
Hi there, 

I have added the SendNotification() to a certain indicator that every now and then draws an arrow for an entry, but the old arrows stay on the chart forever, and whenever I put my info with the notification option it sends me notifications of all old signals.

What I would like it to do that to send me only new signals

I have attached the source code without my modification if needed.

Thanks ahead!
 

All bars are recounted with each tick.

//+------------------------------------------------------------------+
//| 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 limit,hhb,llb;
   
   if (ShowBars >= rates_total) ShowBars = rates_total;
   
   limit = (prev_calculated<1) ? ShowBars-1 : rates_total-prev_calculated+dist/2;
   
   for (int i=limit;i>=0;i--)   {
   
      b1[i]=0;
      b2[i]=0;
      b3[i]=0;
      b4[i]=0;
      
      hhb = iHighest(_Symbol,0,MODE_HIGH,dist,i-dist/2);
      llb = iLowest(_Symbol,0,MODE_LOW,dist,i-dist/2);

      
      if (i==hhb)
         b3[i]=high[hhb]+SignalGap*Point;
      
      if (i==llb)
         b4[i]=low[llb]-SignalGap*Point;
         
         b1[i]=high[hhb];//+SignalGap*Point;
         b2[i]=low[llb];//-SignalGap*Point;
     }   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
That means that the alerts and notifications will be sent each tick again again? No way to make notifications only of the new signals?
 
imichaeli:
That means that the alerts and notifications will be sent each tick again again? No way to make notifications only of the new signals?

The above code only counts the last bars after first run and this should send notification once. Please show your attempt next time.

      hhb = iHighest(_Symbol,0,MODE_HIGH,dist,i-dist/2);
      llb = iLowest(_Symbol,0,MODE_LOW,dist,i-dist/2);

      static bool alert1=false,alert2=false;
      if (i==hhb)
        {
         b3[i]=high[hhb]+SignalGap*Point;
         if(prev_calculated>0 && hhb==0 && !alert1)
           {
            SendNotification();
            alert1=true;
           }
        }
      
      if (i==llb)
         b4[i]=low[llb]-SignalGap*Point;
         
         b1[i]=high[hhb];//+SignalGap*Point;
         b2[i]=low[llb];//-SignalGap*Point;
     
      if(prev_calculated!=rates_total)
         alert1=alert2=false;