Hi
I have an EMA crosses indicator but it has no sound alert coded into the script.
Pls help with how I can add sound alert to it.
The indicator is for the cross of a fast moving average over a slower one and I want to add to the codes so that it can sound an alert when the crosses happen on any time frame.
Thanks

The codes are below.....



//+------------------------------------------------------------------+
//| MA cross.mq4 - I found it at fxfisherman.com |
//| Copyright 2012, Forex Programming | Metatrader Programming |
//| Forex Programming | Metatrader Programming |
//+------------------------------------------------------------------+
//#property copyright "Copyright 2012, www.forex-programming.com"
//#property link "www.forex-programming.com"

#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);
}