-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Engulfing Bar Alert.mq4
75 lines (55 loc) · 1.86 KB
/
_Engulfing Bar Alert.mq4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//+------------------------------------------------------------------+
//| Engulfing Bar Alert.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet
//---- buffers
double Up[],Dn[];
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,Up);
SetIndexBuffer(1,Dn);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
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;
// UP
if (Close[i+1]>Open[i+1]&&Close[i+2]<Open[i+2]&&Close[i+1]>Open[i+2]&&Open[i+1]<=Close[i+2])
{
Up[i+1]=Low[i+1]-Range*1.5;
}
// DOWN
if (Close[i+1]<Open[i+1]&&Close[i+2]>Open[i+2]&&Close[i+1]<Open[i+2]&&Open[i+1]>=Close[i+2])
{
Dn[i+1]=High[i+1]+Range*1.5;
}
}
return(0);
}