Need Help on the programming :The Audio Alert on MACD crossing

 
Re :Audio Alert on Macd Crossings
Basically what i needed is a audio alert output whereby a sell or buy signal triggers in the Macd .The codes that i have devised is not really making any sound upon MACD crossings ..Please advise me further as to how i can achieve my goal here .Is there anything else that i should do to make it work ?
 
 
Yes but i cant solve this, can you help as why the aler not working.
Thanks for your kind attention
 
Rosh:
Did yoy see Sound Alerts in Indicators ?

Yes but i cant solve this, can you help as why the aler not working.
Thanks for your kind attention
 
Probably , you mean this ?
//+------------------------------------------------------------------+
//|                                                  MACD Sample.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       https://www.metaquotes.net// |
//+------------------------------------------------------------------+
extern bool UseAlert=true;
extern double TakeProfit = 50;
extern double Lots = 0.1;
extern double TrailingStop = 30;
extern double MACDOpenLevel=3;
extern double MACDCloseLevel=2;
extern double MATrendPeriod=26;
 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
{
   double MacdCurrent, MacdPrevious, SignalCurrent;
   double SignalPrevious, MaCurrent, MaPrevious;
   int cnt, ticket, total;
// initial data checks
// it is important to make sure that the expert works with a normal
// chart and the user did not make any mistakes setting external 
// variables (Lots, StopLoss, TakeProfit, 
// TrailingStop) in our case, we check TakeProfit
// on a chart of less than 100 bars
   if(Bars<100)
   {
      Print("bars less than 100");
      return(0);  
   }
   
// to simplify the coding and speed up access
// data are put into internal variables
   MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
   MacdPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
   SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
   SignalPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
   MaCurrent=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,0);
   MaPrevious=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,1);
 
   total=OrdersTotal();
 
   if(total<1) 
   {
      // no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
      {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);
      }
   }
 
   // check for long position (BUY) possibility
   if(MacdCurrent<0 && (MacdCurrent>SignalCurrent) && (MacdPrevious<SignalPrevious) && (MathAbs(MacdCurrent-MacdPrevious)>MACDOpenLevel*Point) && (MaCurrent>MaPrevious) && UseAlert)
   {
      Alert("MacdCurrent CROSSing");
   }      
 
   // check for short position (SELL) possibility
   if(MacdCurrent>0 && (MacdCurrent<SignalCurrent) && (MacdPrevious>SignalPrevious) && (MathAbs(MacdCurrent-MacdPrevious)>MACDOpenLevel*Point) && (MaCurrent<MaPrevious)&& UseAlert)
   {
      Alert("MacdCurrent CROSSing");
   }
 
   // it is important to enter the market correctly, 
   return(0);
 
}
// the end.
 
PlaySound(filename)