//+------------------------------------------------------------------+
//| QQE_Cross.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
extern int SF = 1;
extern bool Visual_Alert=true;
extern bool Audio_Alert=true;
extern string Audio_Up_File="alert.wav";
extern string Audio_Down_File="alert.wav";
extern bool Email_Alert=true;
extern int Count_Bars=EMPTY_VALUE;
extern int Arrow_Offset=5;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
bool up=false;
bool dn=false;
datetime last_t=0;
int init()
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
return(0);
}
int deinit(){return(0);}
int start()
{
int l=0;
if (Count_Bars>Bars) {l=Bars;}else{l=Count_Bars;}
for (int i=l;i>=0;i--){
ExtMapBuffer1[i]=0;
ExtMapBuffer2[i]=0;
double qqe0_0=iCustom(Symbol(),0,"QQE",SF,0,i);
double qqe0_1=iCustom(Symbol(),0,"QQE",SF,0,i+1);
double qqe1_0=iCustom(Symbol(),0,"QQE",SF,1,i);
double qqe1_1=iCustom(Symbol(),0,"QQE",SF,1,i+1);
if (qqe0_0>qqe1_0 && qqe0_1<=qqe1_1 && !up){
ExtMapBuffer1[i]=Low[i]-Arrow_Offset*Point;
up=true;
dn=false;
}
if (qqe0_0<qqe1_0 && qqe0_1>=qqe1_1 && !dn){
ExtMapBuffer2[i]=High[i]+Arrow_Offset*Point;
dn=true;
up=false;
}
}
if (ExtMapBuffer1[0]>0){
if (Visual_Alert) Alert("Cross up on : "+Symbol()+" at "+TimeToStr(TimeCurrent()));
if (Audio_Alert) PlaySound(Audio_Up_File);
if (Email_Alert) SendMail("QQE_Cross Alert","Cross up on : "+Symbol()+" at "+TimeToStr(TimeCurrent()));
}
if (ExtMapBuffer2[0]>0){
if (Visual_Alert) Alert("Cross down on : "+Symbol()+" at "+TimeToStr(TimeCurrent()));
if (Audio_Alert) PlaySound(Audio_Down_File);
if (Email_Alert) SendMail("QQE_Cross Alert","Cross down on : "+Symbol()+" at "+TimeToStr(TimeCurrent()));
}
return(0);
}
Comments