please help on sendnotification

 

i try to edit volume indicator to send noticfication when turning color from red to green, ends up having many notification, can anybody help me?i just only 1 nitidication.

The actual indicator i take from the standard volume indicator from mt5. this is part of it:


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

  {

//---check for rates total

   if(rates_total<2)

      return(0);

//--- starting work

   int start=prev_calculated-1;

//--- correct position

   if(start<1) start=1;

//--- main cycle

   if(InpVolumeType==VOLUME_TICK)

      CalculateVolume(start,rates_total,tick_volume);

   else

      CalculateVolume(start,rates_total,volume);

//--- OnCalculate done. Return new prev_calculated.

   return(rates_total);

  }

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void CalculateVolume(const int nPosition,

                     const int nRatesCount,

                     const long &SrcBuffer[])

  {

   ExtVolumesBuffer[0]=(double)SrcBuffer[0];

   ExtColorsBuffer[0]=0.0;

//---

   for(int i=nPosition;i<nRatesCount && !IsStopped();i++)

     {

      //--- get some data from src buffer

      double dCurrVolume=(double)SrcBuffer[i];

      double dPrevVolume=(double)SrcBuffer[i-1];

      //--- calculate indicator

      ExtVolumesBuffer[i]=dCurrVolume;

      if(dCurrVolume>dPrevVolume)

         ExtColorsBuffer[i]=0.0;

      else

         ExtColorsBuffer[i]=1.0;

         if(dCurrVolume>dPrevVolume) SendNotification (Symbol()) ; else;

     }

     

//---
Reason: