-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSignal-COunt-with array.mq4
169 lines (117 loc) · 12 KB
/
Signal-COunt-with array.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//+------------------------------------------------------------------+
//| Tipu_CCI_Oppo.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com | inceabdullah@yahoo.com
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//--- input parameters
input string IndName="Tipu CCI"; // Indicator Name
double GetInd_iCustom[101];
double GetInd_iCustom_old[101];
double GetInd_iCustom_changed[101];
double GetInd_iCustom_maxInt[101];
double GetInd_iCustom_minInt[101];
double GetInd_iCustom_Zero[101];
double GetInd_iCustom_NewNotMax[101];
double GetInd_iCustom_OldNotMax[101];
double ConsExp;
double ConsExp_old;
string GetInd_iCustom_changed_Cons;
string GetInd_iCustom_maxInt_Cons;
string GetInd_iCustom_minInt_Cons;
string GetInd_iCustom_Zero_Cons;
string GetInd_iCustom_NewNotMax_Cons;
string GetInd_iCustom_OldNotMax_Cons;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void GetInd()
{
for(int iiCustomFOR=0; iiCustomFOR<=7; iiCustomFOR++)
{
for(int jiCustomFOR=0; jiCustomFOR<=1; jiCustomFOR++)
{
ConsExp_old=GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR];
GetInd_iCustom_old[(iiCustomFOR*10)+jiCustomFOR]=ConsExp_old;
ConsExp=iCustom(NULL,0,IndName,iiCustomFOR,jiCustomFOR);
GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]=ConsExp;
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void TradeChanged()
{
for(int iiCustomFOR=0; iiCustomFOR<=7; iiCustomFOR++)
{
for(int jiCustomFOR=0; jiCustomFOR<=1; jiCustomFOR++)
{
if(GetInd_iCustom_old[(iiCustomFOR*10)+jiCustomFOR]!=GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]) // if different before it was
{
GetInd_iCustom_changed_Cons=GetInd_iCustom_changed[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_changed[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_changed_Cons;
}
if(GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]==2147483647) // if different before it was
{
GetInd_iCustom_maxInt_Cons=GetInd_iCustom_maxInt[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_maxInt[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_maxInt_Cons;
}
if(GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]==-2147483646) // if different before it was
{
GetInd_iCustom_minInt_Cons=GetInd_iCustom_minInt[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_minInt[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_minInt_Cons;
}
if(GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]!=0 && GetInd_iCustom_old[(iiCustomFOR*10)+jiCustomFOR]==0) // if Zero but before not
{
GetInd_iCustom_Zero_Cons=GetInd_iCustom_Zero[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_Zero[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_Zero_Cons;
}
if(GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]!=2147483647 && GetInd_iCustom_old[(iiCustomFOR*10)+jiCustomFOR]==2147483647) // if Zero
{
GetInd_iCustom_NewNotMax_Cons=GetInd_iCustom_NewNotMax[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_NewNotMax[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_NewNotMax_Cons;
}
if(GetInd_iCustom[(iiCustomFOR*10)+jiCustomFOR]==2147483647 && GetInd_iCustom_old[(iiCustomFOR*10)+jiCustomFOR]!=2147483647) // if Zero
{
GetInd_iCustom_OldNotMax_Cons=GetInd_iCustom_OldNotMax[(iiCustomFOR*10)+jiCustomFOR]+1;
GetInd_iCustom_OldNotMax[(iiCustomFOR*10)+jiCustomFOR]=GetInd_iCustom_OldNotMax_Cons;
}
}
} //for iiCustomFOR ends
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
string TotComments = "int, int : Mode,Shift\n";
string Comments="Indicator Name:"+IndName+"\n";
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CommentArrays()
{
for(int iiCustomFOR=0; iiCustomFOR<=7; iiCustomFOR++)
{
for(int jiCustomFOR=0; jiCustomFOR<=1; jiCustomFOR++)
{
TotComments=TotComments+iiCustomFOR+","+jiCustomFOR+" - Old Dif New : "+GetInd_iCustom_changed[(iiCustomFOR*10)+jiCustomFOR]+" MaxInt "+GetInd_iCustom_maxInt[(iiCustomFOR*10)+jiCustomFOR]+" MinInt "+GetInd_iCustom_minInt[(iiCustomFOR*10)+jiCustomFOR]+" Zero "+GetInd_iCustom_Zero[(iiCustomFOR*10)+jiCustomFOR]+" NewNotax "+GetInd_iCustom_NewNotMax[(iiCustomFOR*10)+jiCustomFOR]+" OldNotMax "+GetInd_iCustom_OldNotMax[(iiCustomFOR*10)+jiCustomFOR]+"\n";
}
}
Comment(Comments+TotComments);
// Comment(GetInd_iCustom_changed[10]);
TotComments="int, int : Mode,Shift\n";
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnTick()
{
//---
GetInd(); //Get Indicator via iCustom
TradeChanged(); //Do Trade
CommentArrays();
}
//+------------------------------------------------------------------+