j’ai pas besoin des alertes que les flèches merci
//+——————————————————————+
//| Engulfing Bar Alert.mq4 |
//| |
//| |
//+——————————————————————+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 red
extern string ahi=”******* ALERT SETTINGS:”;
extern bool Use_BullEngulfing = true;
extern bool Use_BearEngulfing = true;
extern int AlertCandle = 0;//0:current, 1:last bar, etc.
extern bool PopupAlerts = true;
extern bool EmailAlerts = false;
extern bool PushNotificationAlerts = false;
extern bool SoundAlerts = false;
extern string SoundFileLong = “alert.wav”;
extern string SoundFileShort = “alert2.wav”;
int lastAlert=3;
//—- buffers
double Up[],Dn[];
double cl2,op2,cl1,op1;
//+——————————————————————+
int init()
{
SetIndexBuffer(0,Up);
SetIndexBuffer(1,Dn);
if(Use_BullEngulfing){SetIndexStyle(0,DRAW_ARROW);}else{SetIndexStyle(0,DRAW_NONE);}
if(Use_BearEngulfing){SetIndexStyle(1,DRAW_ARROW);}else{SetIndexStyle(1,DRAW_NONE);}
SetIndexArrow(0,233);
SetIndexArrow(1,234);
return(0);
}
//+——————————————————————+
int deinit()
{
return(0);
}
//+——————————————————————+
int start() {
int i, counter;
double Range, AvgRange;
int CountBars=Bars;
for(i=0; i<CountBars; i++)
{
counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+2;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
cl1=Close[i+1];
cl2=Close[i+2];
op1=Open[i+1];
op2=Open[i+2];
// UP
if(Use_BullEngulfing){
if (cl1>op1 && cl2<op2 && cl1>=op2 && op1<=cl2)
{
Up[i+1]=Low[i+1]-Range*1.5;
if (i==AlertCandle) if (lastAlert!=2) { doAlerts(“BULLISH”,SoundFileLong); lastAlert=2; }
}}
// DOWN
if(Use_BearEngulfing){
if (cl1<op1 && cl2>op2 && op1>=cl2 && cl1<=op2)
{
Dn[i+1]=High[i+1]+Range*1.5;
if (i==AlertCandle) if (lastAlert!=1) { doAlerts(“BEARISH”,SoundFileShort); lastAlert=1; }
}}
}
return(0);
}
//stuff by fxdaytrader
void doAlerts(string msg,string SoundFile) {
msg=”Engulfing Bar Alert on “+Symbol()+”, period “+TFtoStr(Period())+”: “+msg+” Engulfing detected.”;
string emailsubject=”MT4 alert on acc. “+AccountNumber()+”, “+WindowExpertName()+” – Alert on “+Symbol()+”, period “+TFtoStr(Period());
if (PopupAlerts) Alert(msg);
if (EmailAlerts) SendMail(emailsubject,msg);
if (PushNotificationAlerts) SendNotification(msg);
if (SoundAlerts) PlaySound(SoundFile);
}//void doAlerts(string msg,string SoundFile) {
string TFtoStr(int period) {
switch(period) {
case 1 : return(“M1”); break;
case 5 : return(“M5”); break;
case 15 : return(“M15”); break;
case 30 : return(“M30”); break;
case 60 : return(“H1”); break;
case 240 : return(“H4”); break;
case 1440 : return(“D1”); break;
case 10080 : return(“W1”); break;
case 43200 : return(“MN1”); break;
default : return(DoubleToStr(period,0));
}
return(“UNKNOWN”);
}//string TFtoStr(int period) {
//end