Could someone help me add an audible alert to this indicator?
Thanks!
Thanks!
Attached File(s)
Problems with audible alert 4 replies
Add Audible and Visual Alert Please 0 replies
Need audible alert for megatrend indicator 2 replies
Audible alert for (mad) Moving Average Delta indicator 9 replies
MT4 Audible alert and pop-up 0 replies
//+------------------------------------------------------------------+
//|
//|
//+------------------------------------------------------------------+
#property copyright "niva"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
extern bool Email_Enabled = false;
extern bool Alert_Enabled = true;
//---- input parameters
int CountBars=10000;
//---- buffers
double uptrend[];
double downtrend[];
bool AlertSent,EmailSent;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,217);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,218);
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2 |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
int i,shift,counted_bars=IndicatorCounted();
int uptrend, downtrend;
for (shift = CountBars; shift>=0; shift--)
{
if(High[shift-1]>High[shift]&&Low[shift-1]>Low[shift]&&uptrend!=3){
uptrend = uptrend+1;
downtrend=0;
}else if(High[shift-1]<High[shift]&&Low[shift-1]<Low[shift]&&downtrend!=3){
downtrend=downtrend+1;
uptrend=0;
}
else{
uptrend=0;
downtrend=0;
}
if (uptrend==3)
{
val1[shift]=Low[shift];
}
if (downtrend==3)
{
val2[shift]=High[shift];
}
}
return(0);
}
//----
if (Alert_Enabled && (uptrend[0] != 0 || uptrend[0] !=0) && !AlertSent)
{
Alert(Symbol() + "HiLow+3");
AlertSent=true;
}
if (Email_Enabled && (downtrend[0] != 0 || downtrend[0] !=0) && !EmailSent)
{
SendMail(Symbol() + "HiLow+3","HiLow+3 indicator triggered");
EmailSent=true;
}
if(downtrend[0] == 0 && uptrend[0] == 0 )
{
EmailSent=false;
AlertSent=false;
}
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|
//|
//+------------------------------------------------------------------+
#property copyright "niva"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 Red
extern bool Email_Enabled = false;
extern bool Alert_Enabled = true;
//---- input parameters
int CountBars=10000;
//---- buffers
double uptrend[];
double downtrend[];
bool AlertSent,EmailSent;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,217);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,218);
SetIndexBuffer(0,val1);
SetIndexEmptyValue(0,0.0);
SetIndexBuffer(1,val2);
SetIndexEmptyValue(1,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2 |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
int i,shift,counted_bars=IndicatorCounted();
int uptrend, downtrend;
for (shift = CountBars; shift>=0; shift--)
{
if(High[shift-1]>High[shift]&&Low[shift-1]>Low[shift]&&uptrend!=3){
uptrend = uptrend+1;
downtrend=0;
}else if(High[shift-1]<High[shift]&&Low[shift-1]<Low[shift]&&downtrend!=3){
downtrend=downtrend+1;
uptrend=0;
}
else{
uptrend=0;
downtrend=0;
}
if (uptrend==3)
{
val1[shift]=Low[shift];
}
if (downtrend==3)
{
val2[shift]=High[shift];
}
}
return(0);
}
//----
if (Alert_Enabled && (uptrend[0] !=EMPTY_VALUE || uptrend[0] !=EMPTY_VALUE) && !AlertSent)
{
Alert(Symbol() + "HiLow+3");
AlertSent=true;
}
if (Email_Enabled && (downtrend[0] !=EMPTY_VALUE || downtrend[0] !=EMPTY_VALUE) && !EmailSent)
{
SendMail(Symbol() + "HiLow+3","HiLow+3 indicator triggered");
EmailSent=true;
}
if(downtrend[0] == 0 && uptrend[0] == 0 )
{
EmailSent=false;
AlertSent=false;
}
return(0);
}
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Yellow
#property indicator_width1 3
#property indicator_width2 3
//---- input parameters
int CountBars=10000;
//----
extern bool Email_Enabled = false;
extern bool Alert_Enabled = true;
//---- buffers
double val1[];
double val2[];
bool AlertSent,EmailSent;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,217);
SetIndexBuffer(0,val1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,218);
SetIndexBuffer(1,val2);
SetIndexEmptyValue(1,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
int i,shift,counted_bars=IndicatorCounted();
int uptrend, downtrend;
for (shift = CountBars; shift>=0; shift--)
{
if(High[shift-1]>High[shift]&&Low[shift-1]>Low[shift]&&uptrend!=3){
uptrend = uptrend+1;
downtrend=0;
}else if(High[shift-1]<High[shift]&&Low[shift-1]<Low[shift]&&downtrend!=3){
downtrend=downtrend+1;
uptrend=0;
}
else{
uptrend=0;
downtrend=0;
}
if (uptrend==3)
{
val1[shift]=Low[shift];
}
if (downtrend==3)
{
val2[shift]=High[shift];
}
}
//----
if (Alert_Enabled && (val2[0] != 0 || val1[0] !=0) && !AlertSent)
{
Alert(Symbol() + "HiLow+3");
AlertSent=true;
}
if (Email_Enabled && (val2[0] != 0 || val1[0] !=0) && !EmailSent)
{
SendMail(Symbol() + "HiLow+3","Buy/Sell");
EmailSent=true;
}
if(val2[0] == 0 && val1[0] == 0 )
{
EmailSent=false;
AlertSent=true;
}
return(0);
}
//+------------------------------------------------------------------+