Help add sound wav alert to this code

 

Hi.


Pls help add a sound alert code into this indicator.


Its a 2 period moving average cross over indicator but presently does not have sound. I want it to be able to sound an alert when a cross occurs


The line of codes are below.....


--------------------------------------------------------------------------------------------------------


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 DarkSlateBlue
#property indicator_width1  2
#property indicator_width2  2

extern string s="--- Alert settings ---";
extern bool   ScreenAlert     =true,
              PushAlert       =false;

extern string s11=" // Fast MA period // ";
extern int    Fast_MA_Period  = 3 ;
extern string s12=" // Fast MA shift // ";
extern int    Fast_MA_Shift   = 0 ;
extern string s13=" // Fast MA method // ";
extern string s14="SMA=0, EMA=1, SMMA=2, LWMA=3";
extern int    Fast_MA_Method  = 1 ;
extern string s15=" // Fast MA apply to // ";
extern string s16="Close=0, Open=1, High=2, Low=3";
extern string s17="Median=4, Typical=5, Weighted=6";
extern int    Fast_MA_Apply   = 0 ;

extern string s21=" // Slow MA period // ";
extern int    Slow_MA_Period  = 5 ;
extern string s22=" // Slow MA shift // ";
extern int    Slow_MA_Shift   = 0 ;
extern string s23=" // Slow MA method // ";
extern string s24="SMA=0, EMA=1, SMMA=2, LWMA=3";
extern int    Slow_MA_Method  = 1 ;
extern string s25=" // Slow MA apply to // ";
extern string s26="Close=0, Open=1, High=2, Low=3";
extern string s27="Median=4, Typical=5, Weighted=6";
extern int    Slow_MA_Apply   = 0 ;

double        Fast[], Slow[];
datetime      New_Time=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//   Comment("www.forex-programming.com");
  
   SetIndexBuffer(0, Fast);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexLabel(0, "Fast MA");
   SetIndexBuffer(1, Slow);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexLabel(1, "Slow MA");
  
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   Comment("");
  
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int limit=Bars-counted_bars;
   if (limit<0) limit=0;
  
   // define MAs values
   for (int i=limit; i>=0; i--)
      {
       Fast[i]=iMA(NULL, 0, Fast_MA_Period, Fast_MA_Shift, Fast_MA_Method, Fast_MA_Apply, i);
       Slow[i]=iMA(NULL, 0, Slow_MA_Period, Slow_MA_Shift, Slow_MA_Method, Slow_MA_Apply, i);
      }

   // Alert
      {
       // buy alert
       if ((New_Candle() && Fast[1] > Slow[1] && Fast[2] <= Slow[2]))
         {
          if (ScreenAlert) Alert("BUY - "+Symbol()," | ",TimeToStr(CurTime(),TIME_DATE)," | ",TimeHour(CurTime()),":",TimeMinute(CurTime())," | Period=",Period());
          if (PushAlert) SendNotification("BUY -"+Symbol());
         }
       // sell alert
       if ((New_Candle() && Fast[1] < Slow[1] && Fast[2] >= Slow[2]))
         {
          if (ScreenAlert) Alert("SELL - "+Symbol()," | ",TimeToStr(CurTime(),TIME_DATE)," | ",TimeHour(CurTime()),":",TimeMinute(CurTime())," | Period=",Period());
          if (PushAlert) SendNotification("SELL - "+Symbol());
         }
      }
  
   return(0);
  }

//+------------------------------------------------------------------+
//| Define new candle                                                |
//+------------------------------------------------------------------+
bool New_Candle()
  {
   if (New_Time!=Time[0])
     {
      New_Time=Time[0];
      return(true);
     }
    else
     {
      return(false);
     }
  }

//+------------------------------------------------------------------+
//| Period to String                                                 |
//+------------------------------------------------------------------+
string TFName( int tf )
{
   switch(tf) {
      case PERIOD_M1: return("M1"); break;
        case PERIOD_M5: return("M5"); break;
        case PERIOD_M15: return("M15"); break;
        case PERIOD_M30: return("M30"); break;
        case PERIOD_H1: return("H1"); break;
        case PERIOD_H4: return("H4"); break;
        case PERIOD_D1: return("Daily"); break;
        case PERIOD_W1: return("Weekly"); break;
        case PERIOD_MN1: return("Monthly"); break;
        default: return(TFName(Period()));
    }
   
    return(0);

 
extern string s="--- Alert settings ---";
extern bool   ScreenAlert     =true,
              PushAlert       =false,
              SoundAlert      =false;
if (PushAlert) SendNotification("BUY -"+Symbol());
if (SoundAlert) PlaySound("buy.wav");
if (PushAlert) SendNotification("SELL - "+Symbol());
if (SoundAlert) PlaySound("sell.wav");
The wav files go into the Sounds directory of the MT installation.