|
|
@@ -34,6 +34,9 @@ int Store_bos_last_index = 0;
|
|
34
|
34
|
|
|
35
|
35
|
bool choch = false;
|
|
36
|
36
|
int index = 0;
|
|
|
37
|
+
|
|
|
38
|
+int arrow_code_high = 108;
|
|
|
39
|
+int arrow_code_low = 108;
|
|
37
|
40
|
//+------------------------------------------------------------------+
|
|
38
|
41
|
//| Expert initialization function |
|
|
39
|
42
|
//+------------------------------------------------------------------+
|
|
|
@@ -44,6 +47,7 @@ void Bos(int i)
|
|
44
|
47
|
{
|
|
45
|
48
|
|
|
46
|
49
|
|
|
|
50
|
+
|
|
47
|
51
|
high = iHigh(Symbol(),PERIOD_CURRENT,high_index);
|
|
48
|
52
|
|
|
49
|
53
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -51,8 +55,19 @@ void Bos(int i)
|
|
51
|
55
|
|
|
52
|
56
|
if(high1 > high)
|
|
53
|
57
|
{
|
|
|
58
|
+
|
|
|
59
|
+ if(object_find("high") > 0)
|
|
|
60
|
+ {
|
|
|
61
|
+ ObjectDelete(0,"high");
|
|
|
62
|
+
|
|
|
63
|
+ }
|
|
|
64
|
+
|
|
54
|
65
|
high = high1;
|
|
55
|
66
|
|
|
|
67
|
+ ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
68
|
+ ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
69
|
+ ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
|
70
|
+
|
|
56
|
71
|
ObjectCreate(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),high);
|
|
57
|
72
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
58
|
73
|
|
|
|
@@ -92,12 +107,19 @@ void Bos(int i)
|
|
92
|
107
|
|
|
93
|
108
|
}
|
|
94
|
109
|
}
|
|
|
110
|
+ if(object_find("low") > 0)
|
|
|
111
|
+ {
|
|
|
112
|
+ ObjectDelete(0,"low");
|
|
|
113
|
+
|
|
|
114
|
+ }
|
|
|
115
|
+ ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_low),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
116
|
+ ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
|
117
|
+
|
|
|
118
|
+ ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
95
|
119
|
bearish_found = false;
|
|
96
|
120
|
|
|
97
|
121
|
}
|
|
98
|
122
|
|
|
99
|
|
- Print(" high price is ", high);
|
|
100
|
|
- Print("low price is ", low);
|
|
101
|
123
|
|
|
102
|
124
|
|
|
103
|
125
|
high_index = i;
|
|
|
@@ -116,16 +138,29 @@ void Bos(int i)
|
|
116
|
138
|
|
|
117
|
139
|
low1 = iLow(Symbol(),PERIOD_CURRENT,i);
|
|
118
|
140
|
|
|
119
|
|
-
|
|
120
|
141
|
if(low1 < low)
|
|
121
|
142
|
{
|
|
122
|
|
- Store_bos_last_index = i;
|
|
123
|
143
|
|
|
|
144
|
+ if(object_find("low") > 0)
|
|
|
145
|
+ {
|
|
|
146
|
+ ObjectDelete(0,"low");
|
|
124
|
147
|
|
|
|
148
|
+ }
|
|
125
|
149
|
low = low1;
|
|
|
150
|
+ ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
151
|
+ ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
|
152
|
+
|
|
|
153
|
+ ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
154
|
+
|
|
126
|
155
|
|
|
127
|
156
|
ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
128
|
157
|
ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
|
158
|
+
|
|
|
159
|
+ Store_bos_last_index = i;
|
|
|
160
|
+
|
|
|
161
|
+
|
|
|
162
|
+
|
|
|
163
|
+
|
|
129
|
164
|
int count = (low_index-1) - i;
|
|
130
|
165
|
|
|
131
|
166
|
|
|
|
@@ -160,11 +195,18 @@ void Bos(int i)
|
|
160
|
195
|
|
|
161
|
196
|
}
|
|
162
|
197
|
}
|
|
|
198
|
+ if(object_find("high") > 0)
|
|
|
199
|
+ {
|
|
|
200
|
+ ObjectDelete(0,"high");
|
|
|
201
|
+
|
|
|
202
|
+ }
|
|
|
203
|
+ ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
204
|
+ ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
205
|
+ ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
163
|
206
|
bullish_found = false;
|
|
164
|
207
|
|
|
165
|
208
|
}
|
|
166
|
|
- Print("low price is ", low);
|
|
167
|
|
- Print(" high price is ", high);
|
|
|
209
|
+
|
|
168
|
210
|
|
|
169
|
211
|
|
|
170
|
212
|
|
|
|
@@ -198,7 +240,7 @@ void Entry_Action_1_up(int Store_bos_last_index, int i)
|
|
198
|
240
|
|
|
199
|
241
|
if(bearish_found == true)
|
|
200
|
242
|
{
|
|
201
|
|
- Print("index xi is ", ind);
|
|
|
243
|
+
|
|
202
|
244
|
ObjectCreate(0,"line10"+iTime(Symbol(),PERIOD_CURRENT,ind),OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,ind),iHigh(Symbol(),PERIOD_CURRENT,ind),iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,ind));
|
|
203
|
245
|
ObjectCreate(0,"line11"+iTime(Symbol(),PERIOD_CURRENT,ind),OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,ind),iLow(Symbol(),PERIOD_CURRENT,ind),iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,ind));
|
|
204
|
246
|
|
|
|
@@ -224,7 +266,7 @@ void Entry_Action_1_up(int Store_bos_last_index, int i)
|
|
224
|
266
|
//+------------------------------------------------------------------+
|
|
225
|
267
|
void Entry_Action_1_down(int Store_bos_last_index, int i,int diff)
|
|
226
|
268
|
{
|
|
227
|
|
- diff++;
|
|
|
269
|
+ diff++;
|
|
228
|
270
|
|
|
229
|
271
|
for(int j=Store_bos_last_index+1; j < iBars(Symbol(),PERIOD_CURRENT); j++)
|
|
230
|
272
|
{
|
|
|
@@ -237,10 +279,10 @@ void Entry_Action_1_down(int Store_bos_last_index, int i,int diff)
|
|
237
|
279
|
}
|
|
238
|
280
|
|
|
239
|
281
|
}
|
|
240
|
|
- Print(diff);
|
|
|
282
|
+// Print(diff);
|
|
241
|
283
|
if(bullish_found == true)
|
|
242
|
284
|
{
|
|
243
|
|
- Print("index xi is ", ind);
|
|
|
285
|
+
|
|
244
|
286
|
ObjectCreate(0,"line14"+iTime(Symbol(),PERIOD_CURRENT,ind),OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,ind),iHigh(Symbol(),PERIOD_CURRENT,ind),iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,ind));
|
|
245
|
287
|
ObjectCreate(0,"line15"+iTime(Symbol(),PERIOD_CURRENT,ind),OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,ind),iLow(Symbol(),PERIOD_CURRENT,ind),iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,ind));
|
|
246
|
288
|
|
|
|
@@ -284,6 +326,18 @@ void choch(int i)
|
|
284
|
326
|
Entry_Action_1_up(Store_bos_last_index,i);
|
|
285
|
327
|
|
|
286
|
328
|
low = iLow(Symbol(),PERIOD_CURRENT,i);
|
|
|
329
|
+ low_index = i;
|
|
|
330
|
+
|
|
|
331
|
+ if(object_find("low") > 0)
|
|
|
332
|
+ {
|
|
|
333
|
+ ObjectDelete(0,"low");
|
|
|
334
|
+ }
|
|
|
335
|
+ ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
336
|
+ ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
|
337
|
+
|
|
|
338
|
+ ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
339
|
+
|
|
|
340
|
+
|
|
287
|
341
|
Print("low update due to choch : ", low);
|
|
288
|
342
|
trend = "downtrend";
|
|
289
|
343
|
Print("choch at uptrend index --- ", iTime(Symbol(),PERIOD_CURRENT,i));
|
|
|
@@ -319,6 +373,16 @@ void choch(int i)
|
|
319
|
373
|
|
|
320
|
374
|
|
|
321
|
375
|
high = iHigh(Symbol(),PERIOD_CURRENT,i);
|
|
|
376
|
+ high_index = i;
|
|
|
377
|
+
|
|
|
378
|
+ if(object_find("high") > 0)
|
|
|
379
|
+ {
|
|
|
380
|
+ ObjectDelete(0,"high");
|
|
|
381
|
+
|
|
|
382
|
+ }
|
|
|
383
|
+ ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
384
|
+ ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
385
|
+ ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
322
|
386
|
trend = "uptrend";
|
|
323
|
387
|
|
|
324
|
388
|
Print("high is update due to choch : ", high);
|
|
|
@@ -346,7 +410,20 @@ void third_Condition(int i)
|
|
346
|
410
|
ObjectCreate(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
347
|
411
|
ObjectSetString(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
348
|
412
|
low = low2;
|
|
349
|
|
- Print("low update due to third condition",low);
|
|
|
413
|
+ //low_index = i;
|
|
|
414
|
+ if(object_find("low") > 0)
|
|
|
415
|
+ {
|
|
|
416
|
+ Print("object deleted ");
|
|
|
417
|
+ ObjectDelete(0,"low");
|
|
|
418
|
+
|
|
|
419
|
+ }
|
|
|
420
|
+
|
|
|
421
|
+ ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
422
|
+ ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);
|
|
|
423
|
+
|
|
|
424
|
+ ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
|
425
|
+
|
|
|
426
|
+ Print("low update due to third condition",low," time of the candle is ",iTime(Symbol(),PERIOD_CURRENT,i));
|
|
350
|
427
|
}
|
|
351
|
428
|
}
|
|
352
|
429
|
|
|
|
@@ -358,7 +435,17 @@ void third_Condition(int i)
|
|
358
|
435
|
{
|
|
359
|
436
|
ObjectCreate(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
360
|
437
|
ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
438
|
+
|
|
361
|
439
|
high = high2;
|
|
|
440
|
+ //high_index = i;
|
|
|
441
|
+ if(object_find("high") > 0)
|
|
|
442
|
+ {
|
|
|
443
|
+ ObjectDelete(0,"high");
|
|
|
444
|
+
|
|
|
445
|
+ }
|
|
|
446
|
+ ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
|
447
|
+ ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
|
448
|
+ ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
362
|
449
|
Print("high update due to third condition",high);
|
|
363
|
450
|
}
|
|
364
|
451
|
}
|
|
|
@@ -376,12 +463,14 @@ void foo(int value)
|
|
376
|
463
|
//Print("hi");
|
|
377
|
464
|
//if(l < 2)
|
|
378
|
465
|
{
|
|
379
|
|
-
|
|
380
|
466
|
Bos(i);
|
|
381
|
467
|
choch(i);
|
|
|
468
|
+
|
|
382
|
469
|
third_Condition(i);
|
|
383
|
470
|
|
|
384
|
471
|
|
|
|
472
|
+
|
|
|
473
|
+
|
|
385
|
474
|
l++;
|
|
386
|
475
|
|
|
387
|
476
|
}
|