Email Alert Modification

Back to topics list To post a new topic, please log in or register
avatar
2
kintu11 2015.09.15 15:12
 

Any pro in coding?  I have email alert for set but this indicator sending me non stop emails. So many that my email did not have any more storage capacity and bouncing back. Can anyone modify or advise how to? I would like to have only 1 alert when the criteria met. Its and MFI indicator. Partial code is below

 Thank you in advance.

 

 

 int start()

  {

   int    i,j,nCountedBars;

   double dPositiveMF,dNegativeMF,dCurrentTP,dPreviousTP;

//---- insufficient data

   if(Bars<=MFIPeriod) return(0);

//---- bars count that does not changed after last indicator launch.

   nCountedBars=IndicatorCounted();

//----

   i=Bars-MFIPeriod-1;

   if(nCountedBars>MFIPeriod) 

      i=Bars-nCountedBars-1;

   while(i>=0)

     {

      dPositiveMF=0.0;

      dNegativeMF=0.0;

      dCurrentTP=(High[i]+Low[i]+Close[i])/3;

      for(j=0; j<MFIPeriod; j++)

        {

         dPreviousTP=(High[i+j+1]+Low[i+j+1]+Close[i+j+1])/3;

         if(dCurrentTP>dPreviousTP)

            dPositiveMF+=Volume[i+j]*dCurrentTP;

         else

           {

            if(dCurrentTP<dPreviousTP)

                dNegativeMF+=Volume[i+j]*dCurrentTP;

           }

          dCurrentTP=dPreviousTP;      

        }

      //----

      if(dNegativeMF!=0.0)      

         MFIBuffer[i]=100-100/(1+dPositiveMF/dNegativeMF);

      else

         MFIBuffer[i]=100;

      //----

      i--;

     }

   if(AlertMode)

   {

      if(MFIBuffer[1]<OverBought && MFIBuffer[0]>=OverBought)

         Alert("MFI "+MFIPeriod+ ", Sell @ Level "+OverBought+" - "+Symbol()+" M"+Period()+" @ "+DoubleToStr(Bid,Digits)+"");

      else if(MFIBuffer[1]>OverSold && MFIBuffer[0]<=OverSold)

         Alert("MFI "+MFIPeriod+ ", Buy @ Level "+OverSold+" - "+Symbol()+" M"+Period()+" @ "+DoubleToStr(Bid,Digits)+"");

   }

//----

   return(0);

  }

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

avatar
13001
WHRoeder 2015.09.15 19:26 #
 
kintu11: r sending me non stop emails.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Don't check for a signal.
    if(MFIBuffer[1]<OverBought && MFIBuffer[0]>=OverBought)
       Alert("MFI ...
    Check for a change in signal.
    static bool isBuy=false;
    bool wasBuy = isBuy;
    isBuy = MFIBuffer[1]<OverBought && MFIBuffer[0]>=OverBought)
    if(isBuy && !wasBuy)
       Alert("MFI ...
Back to topics list  

To add comments, please log in or register