-
Notifications
You must be signed in to change notification settings - Fork 2
/
2CCI_ZeroCross_Alert.mq4
63 lines (55 loc) · 2.24 KB
/
2CCI_ZeroCross_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
//+------------------------------------------------------------------+
//| 2CCI_ZeroCross_Alert.mq4 |
//| Copyright © 2005, Jason Robinson (jnrtrading). |
//| http://www.jnrtrading.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Jason Robinson (jnrtrading)."
#property link "http://www.jnrtrading.co.uk"
#property indicator_chart_window
extern int CCI_Trend = 50;
extern int CCI_Entry = 14;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double cciTrendNow, cciTrendPrevious, cciEntry;
cciTrendNow = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 0);
cciTrendPrevious = iCCI(NULL, 0, CCI_Trend, PRICE_TYPICAL, 1);
cciEntry = iCCI(NULL, 0, CCI_Entry, PRICE_TYPICAL, 0);
//----
//Print(cciTrendNow, "...", cciTrendPrevious, "...", cciEntry);
if(cciEntry < 0) {
if((cciTrendNow < 0) && (cciTrendPrevious >= 0)) {
Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed below zero");
}
}
else if(cciEntry > 0) {
if((cciTrendNow > 0) && (cciTrendPrevious <= 0)) {
Alert(Symbol(), " M", Period(), " Trend & Entry CCI Have both crossed above zero");
}
}
Comment("Trend CCI: ", cciTrendNow, " Entry CCI: ", cciEntry);
//----
return(0);
}
//+------------------------------------------------------------------+