PLEASE I NEED HELP

[Deleted]  
I've this code i will pass you, the code, is based in ADX, and has to do 2 things.
First to set Arrows when the ADX make a Cross, and Second to set a 1 Alert when the Arrow is set in the Price Chart.
The Arrow thing is working, but i have the issue that when i try to set up the alerts, i have 2 escenarios the first each tick in the candel it will send me the alert (annoying, if you are using a 5 or biger time fream) and second it only apper the alarm 1 time only but when the next arrow apper it not send the alert.


PLEASE HELP ME, i think is something very simple, but i can't find the answer.

THANKS IN ADVANCES.

//+------------------------------------------------------------------+
//| ADX DOTS W/ALARM                                                 |
//|                                                                  |
//+------------------------------------------------------------------+
 
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
 
// parametros
extern int ADXbars=14;
extern int CB=350;
 
 
// buffers
double var1[];
double var2[];
 
double ppdi,npdi,pmdi,nmdi;
 
//+------------------------------------------------------------------+
//| Funcion de Inicio del Indicador                                  |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexBuffer(0,var1);  
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(1,var2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Señal "ARROW"                                                    |
//+------------------------------------------------------------------+
int start()
  {   
   if (CB>=Bars) CB=Bars;
   SetIndexDrawBegin(0,Bars-CB);
   SetIndexDrawBegin(1,Bars-CB);
   int i,updata,counted_bars=IndicatorCounted();
 
 
   //---- check for possible errors
   if(counted_bars<0) return(-1);
 
   //---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=CB;i++) var1[CB-i]=0.0;
      for(i=1;i<=CB;i++) var2[CB-i]=0.0;
            
     } 
     
for (updata = CB; updata>=0; updata--)
 
{ 
 
    ppdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,updata-1);
    npdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,updata);
    pmdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,updata-1);
    nmdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,updata); 
if (ppdi>pmdi && npdi<nmdi)
{
   var1[updata]=Low[updata]-5*Point;
   Comment ("COMPRA");
}
if (ppdi<pmdi && npdi>nmdi)
{
   var2[updata]=High[updata]+5*Point;
   Comment ("VENTA");
}
}
 
//+------------------------------------------------------------------+
//| Señal de Alerta                                                  |
//+------------------------------------------------------------------+
for (int Temp=1;Temp<=5;Temp++)
{
 
   ppdi=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,1);
   npdi=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,0);
   pmdi=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,1);
   nmdi=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,0);
   
      if ((ppdi>pmdi && npdi<nmdi) && Temp<1) 
      { 
         Alert("-=Venta=- @ "+ Symbol()+" "+Period()+"M","\n","Dia ",Day()," Del Mes ",Month());  
         
      }
 
         
      if ((ppdi<pmdi && npdi>nmdi) && Temp<1)
      {        
         Alert("-=Compra=- @ "+Symbol()+" "+Period()+"M","\n","Dia ",Day()," Del Mes ",Month());    
            
      }
      
 
 }
 
 
   return(0);
  }
//+------------------------------------------------------------------+
[Deleted]  
Replace Alert with PlaySound. You will know the problem is with Alert function or the problem is in EA logic.