-
Notifications
You must be signed in to change notification settings - Fork 1
/
DXTrade Daily Boxed Fibs&Pivots&Gann2.mq4
332 lines (327 loc) · 15.6 KB
/
DXTrade Daily Boxed Fibs&Pivots&Gann2.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/*
Generated by EX4-TO-MQ4 decompiler
E-mail : [email protected]
*/
#property link "Modified by cja & DXTrade"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Black
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black
int g_timeframe_76 = PERIOD_D1;
int gi_80 = D'13.02.2009 15:24:36';
extern color Intra_color = Blue;
extern color Upper_color = DodgerBlue;
extern color Lower_color = DodgerBlue;
extern color Box_color = C'0x26,0x26,0x26';
extern color Box_color1 = DimGray;
//extern int gann_scale = 4;
//extern color Gann_color = Blue;
double g_ihigh_112;
double g_ilow_120;
double gd_160;
double gd_unused_168;
double g_iclose_176;
double g_price_184;
double g_price_192;
double g_price_200;
double g_price_208;
double g_price_216;
double g_price_224;
double g_price_232;
int g_datetime_240;
int init() {
g_price_200 = 0;
g_price_192 = 0;
g_price_184 = 0;
g_price_216 = 0;
g_price_224 = 0;
g_price_232 = 0;
g_price_208 = 0;
return (0);
}
int deinit() {
ObjectDelete("DayBox" + gi_80 + "");
ObjectDelete("DayBox1" + gi_80 + "");
ObjectDelete("ExtBox" + gi_80 + "");
ObjectDelete("ExtBox1" + gi_80 + "");
ObjectDelete("DayBox2" + gi_80 + "");
ObjectDelete("DayBox3" + gi_80 + "");
ObjectDelete("ExtBox2" + gi_80 + "");
ObjectDelete("ExtBox3" + gi_80 + "");
ObjectDelete("DayBox4" + gi_80 + "");
ObjectDelete("DayBox5" + gi_80 + "");
ObjectDelete("ExtBox4" + gi_80 + "");
ObjectDelete("ExtBox5" + gi_80 + "");
ObjectDelete("r1 Label");
ObjectDelete("r1 Line");
ObjectDelete("r2 Label");
ObjectDelete("r2 Line");
ObjectDelete("r3 Label");
ObjectDelete("r3 Line");
ObjectDelete("s1 Label");
ObjectDelete("s1 Line");
ObjectDelete("s2 Label");
ObjectDelete("s2 Line");
ObjectDelete("s3 Label");
ObjectDelete("s3 Line");
ObjectDelete("P Label");
ObjectDelete("P Line");
/*ObjectDelete("Gann1" + gi_80 + "");
ObjectDelete("Gann2" + gi_80 + "");
ObjectDelete("Gann3" + gi_80 + "");
ObjectDelete("Gann4" + gi_80 + "");
ObjectDelete("Gann5" + gi_80 + "");
ObjectDelete("Gann6" + gi_80 + "");
ObjectDelete("Gann7" + gi_80 + "");
ObjectDelete("Gann8" + gi_80 + "");
ObjectDelete("Gann9" + gi_80 + "");
ObjectDelete("Gann10" + gi_80 + "");
ObjectDelete("Gann11" + gi_80 + "");
ObjectDelete("Gann12" + gi_80 + "");
ObjectDelete("Gann13" + gi_80 + "");
ObjectDelete("Gann14" + gi_80 + "");
ObjectDelete("Gann15" + gi_80 + "");
ObjectDelete("Gann16" + gi_80 + "");*/
return (0);
}
int start() {
double l_high_4;
double l_time_12;
double l_low_20;
double l_time_28;
double l_high_36;
double l_time_44;
double l_low_52;
double l_time_60;
double l_high_68;
double l_time_76;
double l_low_84;
double l_time_92;
double l_high_100;
double l_time_108;
double l_low_116;
double l_time_124;
double l_price_136;
double l_price_144;
double l_price_152;
double l_price_160;
double l_price_168;
double l_price_176;
double l_price_184;
for (int li_0 = 0; li_0 < 12; li_0++) {
if (High[li_0] == High[iHighest(NULL, 0, MODE_HIGH, li_0, 3)]) {
l_high_4 = High[li_0];
l_time_12 = Time[li_0];
}
if (Low[li_0] == Low[iLowest(NULL, 0, MODE_LOW, li_0, 3)]) {
l_low_20 = Low[li_0];
l_time_28 = Time[li_0];
}
}
for (li_0 = 0; li_0 < 36; li_0++) {
if (High[li_0] == High[iHighest(NULL, 0, MODE_HIGH, li_0, 1)]) {
l_high_36 = High[li_0];
l_time_44 = Time[li_0];
}
if (Low[li_0] == Low[iLowest(NULL, 0, MODE_LOW, li_0, 1)]) {
l_low_52 = Low[li_0];
l_time_60 = Time[li_0];
}
}
for (li_0 = 0; li_0 < 60; li_0++) {
if (High[li_0] == High[iHighest(NULL, 0, MODE_HIGH, li_0, 24)]) {
l_high_68 = High[li_0];
l_time_76 = Time[li_0];
}
if (Low[li_0] == Low[iLowest(NULL, 0, MODE_LOW, li_0, 24)]) {
l_low_84 = Low[li_0];
l_time_92 = Time[li_0];
}
}
for (li_0 = 0; li_0 < 120; li_0++) {
if (High[li_0] == High[iHighest(NULL, 0, MODE_HIGH, li_0, 12)]) {
l_high_100 = High[li_0];
l_time_108 = Time[li_0];
}
if (Low[li_0] == Low[iLowest(NULL, 0, MODE_LOW, li_0, 12)]) {
l_low_116 = Low[li_0];
l_time_124 = Time[li_0];
}
}
int li_132 = iBarShift(NULL, g_timeframe_76, Time[0]) + 1;
g_ihigh_112 = iHigh(NULL, g_timeframe_76, li_132);
g_ilow_120 = iLow(NULL, g_timeframe_76, li_132);
g_datetime_240 = iTime(NULL, g_timeframe_76, li_132);
gd_unused_168 = iOpen(NULL, g_timeframe_76, li_132);
g_iclose_176 = iClose(NULL, g_timeframe_76, li_132);
g_price_184 = (g_ihigh_112 + g_ilow_120 + g_iclose_176) / 3.0;
g_price_192 = 2.0 * g_price_184 - g_ilow_120;
g_price_200 = g_price_184 + (g_ihigh_112 - g_ilow_120);
g_price_208 = 2.0 * g_price_184 + (g_ihigh_112 - 2.0 * g_ilow_120);
g_price_216 = 2.0 * g_price_184 - g_ihigh_112;
g_price_224 = g_price_184 - (g_ihigh_112 - g_ilow_120);
g_price_232 = 2.0 * g_price_184 - (2.0 * g_ihigh_112 - g_ilow_120);
if (TimeDayOfWeek(g_datetime_240) == 0) {
g_ihigh_112 = MathMax(g_ihigh_112, iHigh(NULL, g_timeframe_76, li_132 + 1));
g_ilow_120 = MathMin(g_ilow_120, iLow(NULL, g_timeframe_76, li_132 + 1));
}
gd_160 = g_ihigh_112 - g_ilow_120;
ObjectDelete("DayBox" + gi_80 + "");
ObjectCreate("DayBox" + gi_80 + "", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_ihigh_112 - gd_160 / 2.0, Time[0], g_ilow_120 + gd_160 / 2.0);
ObjectSet("DayBox" + gi_80 + "", OBJPROP_COLOR, Box_color1);
ObjectSet("DayBox" + gi_80 + "", OBJPROP_BACK, TRUE);
ObjectDelete("DayBox1" + gi_80 + "");
ObjectCreate("DayBox1" + gi_80 + "", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_ihigh_112, Time[0], g_ilow_120);
ObjectSet("DayBox1" + gi_80 + "", OBJPROP_COLOR, Box_color);
ObjectSet("DayBox1" + gi_80 + "", OBJPROP_BACK, TRUE);
ObjectDelete("ExtH Label");
ObjectCreate("ExtH label", OBJ_TEXT, 0, Time[2], g_ihigh_112 + gd_160 / 2.0);
ObjectSetText("ExtH label", "Daily High Ext", 8, "Arial", Green);
ObjectDelete("ExtBox" + gi_80 + "");
ObjectCreate("ExtBox" + gi_80 + "", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_ihigh_112 + gd_160 / 2.0, Time[0], g_ihigh_112 + gd_160 / 2.0);
ObjectSet("ExtBox" + gi_80 + "", OBJPROP_COLOR, Green);
ObjectSet("ExtBox" + gi_80 + "", OBJPROP_BACK, TRUE);
ObjectDelete("ExtL Label");
ObjectCreate("ExtL label", OBJ_TEXT, 0, Time[2], g_ilow_120 - gd_160 / 2.0);
ObjectSetText("ExtL label", "Daily Low Ext", 8, "Arial", Red);
ObjectDelete("ExtBox1" + gi_80 + "");
ObjectCreate("ExtBox1" + gi_80 + "", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_ilow_120 - gd_160 / 2.0, Time[0], g_ilow_120 - gd_160 / 2.0);
ObjectSet("ExtBox1" + gi_80 + "", OBJPROP_COLOR, Red);
ObjectSet("ExtBox1" + gi_80 + "", OBJPROP_BACK, TRUE);
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_136 = g_price_184 - 0.01;
else l_price_136 = g_price_184 - 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_144 = g_price_192 - 0.01;
else l_price_144 = g_price_192 - 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_152 = g_price_200 - 0.01;
else l_price_152 = g_price_200 - 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_160 = g_price_208 - 0.01;
else l_price_160 = g_price_208 - 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_168 = g_price_216 + 0.01;
else l_price_168 = g_price_216 + 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_176 = g_price_224 + 0.01;
else l_price_176 = g_price_224 + 0.0001;
if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "AUDJPY" || Symbol() == "CADJPY" || Symbol() == "CHFJPY") l_price_184 = g_price_232 + 0.01;
else l_price_184 = g_price_232 + 0.0001;
ObjectDelete("P Label");
ObjectCreate("P label", OBJ_TEXT, 0, Time[0], g_price_184);
ObjectSetText("P label", "Pivot", 8, "Arial", Red);
ObjectDelete("P Line");
ObjectCreate("P line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_184, Time[0], l_price_136);
ObjectSet("P line", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("P line", OBJPROP_COLOR, Red);
ObjectSet("P line", OBJPROP_WIDTH, 5);
ObjectSet("p line", OBJPROP_BACK, TRUE);
ObjectDelete("r1 Label");
ObjectCreate("r1 label", OBJ_TEXT, 0, Time[0], g_price_192);
ObjectSetText("r1 label", "R1", 8, "Arial", Fuchsia);
ObjectDelete("r1 Line");
ObjectCreate("r1 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_192, Time[0], l_price_144);
ObjectSet("r1 line", OBJPROP_COLOR, Fuchsia);
ObjectSet("r1 line", OBJPROP_BACK, TRUE);
ObjectDelete("r2 Label");
ObjectCreate("r2 label", OBJ_TEXT, 0, Time[0], g_price_200);
ObjectSetText("r2 label", "R2", 8, "Arial", Fuchsia);
ObjectDelete("r2 Line");
ObjectCreate("r2 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_200, Time[0], l_price_152);
ObjectSet("r2 line", OBJPROP_COLOR, Fuchsia);
ObjectSet("r2 line", OBJPROP_BACK, TRUE);
ObjectDelete("r3 Label");
ObjectCreate("r3 label", OBJ_TEXT, 0, Time[0], g_price_208);
ObjectSetText("r3 label", "R3", 8, "Arial", Fuchsia);
ObjectDelete("r3 Line");
ObjectCreate("r3 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_208, Time[0], l_price_160);
ObjectSet("r3 line", OBJPROP_BACK, TRUE);
ObjectSet("r3 line", OBJPROP_COLOR, Fuchsia);
ObjectDelete("s1 Label");
ObjectCreate("s1 label", OBJ_TEXT, 0, Time[0], g_price_216);
ObjectSetText("s1 label", "S1", 8, "Arial", MediumSlateBlue);
ObjectDelete("s1 Line");
ObjectCreate("s1 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_216, Time[0], l_price_168);
ObjectSet("s1 line", OBJPROP_BACK, TRUE);
ObjectSet("s1 line", OBJPROP_COLOR, MediumSlateBlue);
ObjectDelete("s2 Label");
ObjectCreate("s2 label", OBJ_TEXT, 0, Time[0], g_price_224);
ObjectSetText("s2 label", "S2", 8, "Arial", MediumSlateBlue);
ObjectDelete("s2 Line");
ObjectCreate("s2 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_224, Time[0], l_price_176);
ObjectSet("s2 line", OBJPROP_BACK, TRUE);
ObjectSet("s2 line", OBJPROP_COLOR, MediumSlateBlue);
ObjectDelete("s3 Label");
ObjectCreate("s3 label", OBJ_TEXT, 0, Time[0], g_price_232);
ObjectSetText("s3 label", "S3", 8, "Arial", MediumSlateBlue);
ObjectDelete("s3 Line");
ObjectCreate("s3 line", OBJ_RECTANGLE, 0, g_datetime_240 + 60 * g_timeframe_76, g_price_232, Time[0], l_price_184);
ObjectSet("s3 line", OBJPROP_BACK, TRUE);
ObjectSet("s3 line", OBJPROP_COLOR, MediumSlateBlue);
/*ObjectDelete("Gann1" + gi_80 + "");
ObjectCreate("Gann1" + gi_80 + "", OBJ_GANNLINE, 0, l_time_12, l_high_4);
ObjectSet("Gann1" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann1" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann2" + gi_80 + "");
ObjectCreate("Gann2" + gi_80 + "", OBJ_GANNLINE, 0, l_time_12, l_high_4);
ObjectSet("Gann2" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann2" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann3" + gi_80 + "");
ObjectCreate("Gann3" + gi_80 + "", OBJ_GANNLINE, 0, l_time_44, l_high_36);
ObjectSet("Gann3" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann3" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann4" + gi_80 + "");
ObjectCreate("Gann4" + gi_80 + "", OBJ_GANNLINE, 0, l_time_44, l_high_36);
ObjectSet("Gann4" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann4" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann5" + gi_80 + "");
ObjectCreate("Gann5" + gi_80 + "", OBJ_GANNLINE, 0, l_time_28, l_low_20);
ObjectSet("Gann5" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann5" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann6" + gi_80 + "");
ObjectCreate("Gann6" + gi_80 + "", OBJ_GANNLINE, 0, l_time_28, l_low_20);
ObjectSet("Gann6" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann6" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann7" + gi_80 + "");
ObjectCreate("Gann7" + gi_80 + "", OBJ_GANNLINE, 0, l_time_60, l_low_52);
ObjectSet("Gann7" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann7" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann8" + gi_80 + "");
ObjectCreate("Gann8" + gi_80 + "", OBJ_GANNLINE, 0, l_time_60, l_low_52);
ObjectSet("Gann8" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann8" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann9" + gi_80 + "");
ObjectCreate("Gann9" + gi_80 + "", OBJ_GANNLINE, 0, l_time_76, l_high_68);
ObjectSet("Gann9" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann9" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann10" + gi_80 + "");
ObjectCreate("Gann10" + gi_80 + "", OBJ_GANNLINE, 0, l_time_76, l_high_68);
ObjectSet("Gann10" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann10" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann11" + gi_80 + "");
ObjectCreate("Gann11" + gi_80 + "", OBJ_GANNLINE, 0, l_time_92, l_low_84);
ObjectSet("Gann11" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann11" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann12" + gi_80 + "");
ObjectCreate("Gann12" + gi_80 + "", OBJ_GANNLINE, 0, l_time_92, l_low_84);
ObjectSet("Gann12" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann12" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann13" + gi_80 + "");
ObjectCreate("Gann13" + gi_80 + "", OBJ_GANNLINE, 0, l_time_108, l_high_100);
ObjectSet("Gann13" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann13" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann14" + gi_80 + "");
ObjectCreate("Gann14" + gi_80 + "", OBJ_GANNLINE, 0, l_time_108, l_high_100);
ObjectSet("Gann14" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann14" + gi_80 + "", OBJPROP_SCALE, gann_scale);
ObjectDelete("Gann15" + gi_80 + "");
ObjectCreate("Gann15" + gi_80 + "", OBJ_GANNLINE, 0, l_time_124, l_low_116);
ObjectSet("Gann15" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann15" + gi_80 + "", OBJPROP_SCALE, -gann_scale);
ObjectDelete("Gann16" + gi_80 + "");
ObjectCreate("Gann16" + gi_80 + "", OBJ_GANNLINE, 0, l_time_124, l_low_116);
ObjectSet("Gann16" + gi_80 + "", OBJPROP_COLOR, Gann_color);
ObjectSet("Gann16" + gi_80 + "", OBJPROP_SCALE, gann_scale);*/
return (0);
}