|
|
@@ -84,69 +84,29 @@ datetime time_to_place_trade = 0.0;
|
|
84
|
84
|
//+------------------------------------------------------------------+
|
|
85
|
85
|
void Bos(int i)
|
|
86
|
86
|
{
|
|
87
|
|
-//Print("in boss");
|
|
88
|
|
-//Print("trend is ",trend);
|
|
|
87
|
+ int save_bullish_index = 0;
|
|
|
88
|
+ int save_bearish_index = 0;
|
|
89
|
89
|
|
|
90
|
90
|
|
|
91
|
91
|
if(trend == "uptrend")
|
|
92
|
92
|
{
|
|
93
|
|
-
|
|
94
|
|
- //high = iHigh(Symbol(),PERIOD_CURRENT,high_index);
|
|
95
|
93
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,i);
|
|
96
|
|
-
|
|
97
|
|
-
|
|
98
|
94
|
double close = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
99
|
|
-
|
|
100
|
|
- //Print("high is ",high);
|
|
101
|
|
- //Print("close is ", close,"time is ",iTime(Symbol(),PERIOD_CURRENT,i));
|
|
102
|
|
-
|
|
103
|
|
-
|
|
104
|
95
|
if(close > high)
|
|
105
|
96
|
{
|
|
106
|
|
-
|
|
107
|
|
-
|
|
108
|
|
-
|
|
109
|
|
- //--------------
|
|
110
|
|
-
|
|
111
|
|
- // ObjectCreate(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),high);
|
|
112
|
|
- // ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
113
|
|
- //
|
|
114
|
|
- // store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
115
|
|
- // Print(store_last_bos_index_time);
|
|
116
|
|
- //
|
|
117
|
|
- // Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
118
|
|
- //
|
|
119
|
|
- //
|
|
120
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
121
|
|
-
|
|
122
|
|
- //------------------
|
|
123
|
|
-
|
|
124
|
97
|
high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
|
|
125
|
|
-
|
|
126
|
|
- // Print("high index ",high_index);
|
|
127
|
|
-
|
|
128
|
|
- int count = (high_index-1) - i;
|
|
129
|
|
-
|
|
130
|
|
-
|
|
131
|
|
-
|
|
132
|
|
- // Print("count is ",count);
|
|
133
|
|
-
|
|
134
|
|
- for(int j=count; j >= 1; j--)
|
|
|
98
|
+ for(int j=high_index-1; j > i; j--)
|
|
135
|
99
|
{
|
|
136
|
|
-
|
|
137
|
|
- if(checkCandle(high_index-j) == "Bearish")
|
|
|
100
|
+ if(checkCandle(j) == "Bearish")
|
|
138
|
101
|
{
|
|
|
102
|
+ save_bullish_index = j;
|
|
139
|
103
|
if(object_find("high") > 0)
|
|
140
|
104
|
{
|
|
141
|
105
|
ObjectDelete(0,"high");
|
|
142
|
106
|
|
|
143
|
107
|
}
|
|
144
|
|
-
|
|
145
|
108
|
high = high1;
|
|
146
|
109
|
|
|
147
|
|
- // Print(" high is updated : ",high);
|
|
148
|
|
-
|
|
149
|
|
-
|
|
150
|
110
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
151
|
111
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
152
|
112
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
|
@@ -155,21 +115,13 @@ void Bos(int i)
|
|
155
|
115
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
156
|
116
|
|
|
157
|
117
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
158
|
|
- //Print(store_last_bos_index_time);
|
|
159
|
|
-
|
|
160
|
|
- Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
161
|
118
|
|
|
162
|
119
|
|
|
163
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
164
|
|
-
|
|
165
|
|
-
|
|
166
|
|
- // Print("bearish candle found and its low is ",low);
|
|
|
120
|
+ Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
167
|
121
|
|
|
168
|
|
- low = iLow(Symbol(),PERIOD_CURRENT,high_index-j);
|
|
169
|
|
- // Print("bearish candle found and its low is ",low);
|
|
|
122
|
+ low = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
170
|
123
|
bearish_found = true;
|
|
171
|
|
- count = high_index-j;
|
|
172
|
|
- index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,high_index-j);
|
|
|
124
|
+ index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
173
|
125
|
break;
|
|
174
|
126
|
|
|
175
|
127
|
}
|
|
|
@@ -179,7 +131,7 @@ void Bos(int i)
|
|
179
|
131
|
if(bearish_found == true)
|
|
180
|
132
|
{
|
|
181
|
133
|
|
|
182
|
|
- for(int k=count-1; k > Store_bos_last_index ; k--)
|
|
|
134
|
+ for(int k=save_bullish_index; k > i ; k--)
|
|
183
|
135
|
{
|
|
184
|
136
|
low1 = iLow(Symbol(),PERIOD_CURRENT,k);
|
|
185
|
137
|
if(low1 < low)
|
|
|
@@ -187,17 +139,8 @@ void Bos(int i)
|
|
187
|
139
|
|
|
188
|
140
|
low = low1;
|
|
189
|
141
|
index_of_low_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
190
|
|
-
|
|
191
|
|
- //index_of_low = high_index- k;
|
|
192
|
|
-
|
|
193
|
|
- // Print(" ------------------index of low ",index_of_low);
|
|
194
|
142
|
bearish_found = false;
|
|
195
|
|
-
|
|
196
|
|
-
|
|
197
|
|
-
|
|
198
|
143
|
}
|
|
199
|
|
-
|
|
200
|
|
-
|
|
201
|
144
|
}
|
|
202
|
145
|
|
|
203
|
146
|
if(object_find("low") > 0)
|
|
|
@@ -205,7 +148,7 @@ void Bos(int i)
|
|
205
|
148
|
|
|
206
|
149
|
if(ObjectDelete(0,"low"))
|
|
207
|
150
|
{
|
|
208
|
|
- Print("object deleted :");
|
|
|
151
|
+ //Print("object deleted :");
|
|
209
|
152
|
}
|
|
210
|
153
|
|
|
211
|
154
|
|
|
|
@@ -220,76 +163,30 @@ void Bos(int i)
|
|
220
|
163
|
|
|
221
|
164
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
222
|
165
|
|
|
223
|
|
-
|
|
224
|
|
-
|
|
225
|
|
-
|
|
226
|
166
|
}
|
|
227
|
167
|
|
|
228
|
168
|
|
|
229
|
|
- // Print("high of uptrend is ", high);
|
|
230
|
|
- // Print("low of uptrend is ", low);
|
|
231
|
|
-
|
|
232
|
169
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
233
|
170
|
|
|
234
|
|
-
|
|
235
|
|
-
|
|
236
|
|
-
|
|
237
|
|
-
|
|
238
|
171
|
}
|
|
239
|
172
|
|
|
240
|
173
|
}
|
|
241
|
174
|
|
|
242
|
175
|
if(trend == "downtrend")
|
|
243
|
176
|
{
|
|
244
|
|
-
|
|
245
|
|
-
|
|
246
|
|
- //low = iLow(Symbol(),PERIOD_CURRENT,low_index);
|
|
247
|
177
|
low1 = iLow(Symbol(),PERIOD_CURRENT,i);
|
|
248
|
|
-
|
|
249
|
|
-
|
|
250
|
178
|
double close1 = iClose(Symbol(),PERIOD_CURRENT,i);
|
|
251
|
|
-
|
|
252
|
179
|
if(close1 < low)
|
|
253
|
180
|
{
|
|
254
|
|
-
|
|
255
|
|
-
|
|
256
|
|
-
|
|
257
|
|
- // here the update
|
|
258
|
|
-
|
|
259
|
|
- // ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
260
|
|
- // ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
261
|
|
- //
|
|
262
|
|
- //
|
|
263
|
|
- // store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
264
|
|
- // Print(store_last_bos_index_time);
|
|
265
|
|
- //
|
|
266
|
|
- // Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
267
|
|
- //
|
|
268
|
|
- //
|
|
269
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
270
|
|
-
|
|
271
|
|
- // to this
|
|
272
|
|
-
|
|
273
|
|
- //Store_bos_last_index = i;
|
|
274
|
|
-
|
|
275
|
181
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
276
|
|
-
|
|
277
|
|
- // Print("low index ",low_index);
|
|
278
|
|
-
|
|
279
|
|
-
|
|
280
|
|
- int count = (low_index-1) - i;
|
|
281
|
|
- // Print("count is ",count);
|
|
282
|
|
-
|
|
283
|
|
- for(int j=count; j >= 1; j--)
|
|
|
182
|
+ for(int j=low_index - 1; j > i; j--)
|
|
284
|
183
|
{
|
|
285
|
|
-
|
|
286
|
|
- if(checkCandle(low_index-j) == "Bullish")
|
|
|
184
|
+ if(checkCandle(j) == "Bullish")
|
|
287
|
185
|
{
|
|
288
|
|
-
|
|
|
186
|
+ save_bullish_index = j;
|
|
289
|
187
|
if(object_find("low") > 0)
|
|
290
|
188
|
{
|
|
291
|
189
|
ObjectDelete(0,"low");
|
|
292
|
|
-
|
|
293
|
190
|
}
|
|
294
|
191
|
low = low1;
|
|
295
|
192
|
ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
|
|
|
@@ -297,34 +194,18 @@ void Bos(int i)
|
|
297
|
194
|
|
|
298
|
195
|
ObjectSetInteger(0,"low",OBJPROP_COLOR,clrRed);
|
|
299
|
196
|
|
|
300
|
|
- // -----
|
|
301
|
|
-
|
|
302
|
197
|
ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
303
|
198
|
ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
304
|
199
|
|
|
305
|
|
-
|
|
306
|
200
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
307
|
|
- // Print(store_last_bos_index_time);
|
|
308
|
201
|
|
|
309
|
202
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
310
|
203
|
|
|
311
|
|
-
|
|
312
|
|
- // Print("last bos index is ",Store_bos_last_index);
|
|
313
|
|
-
|
|
314
|
|
- //------
|
|
315
|
204
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
316
|
205
|
|
|
317
|
|
- // Print("low index ",low_index);
|
|
318
|
|
-
|
|
319
|
|
-
|
|
320
|
|
-
|
|
321
|
|
- // Print("bullish candle found and its high is ",high);
|
|
322
|
|
-
|
|
323
|
|
- high = iHigh(Symbol(),PERIOD_CURRENT,low_index-j);
|
|
324
|
|
- // Print("bullish candle found and its high is ",high);
|
|
|
206
|
+ high = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
325
|
207
|
bullish_found = true;
|
|
326
|
|
- count = low_index-j;
|
|
327
|
|
- index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,low_index-j);
|
|
|
208
|
+ index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
328
|
209
|
break;
|
|
329
|
210
|
|
|
330
|
211
|
}
|
|
|
@@ -336,7 +217,7 @@ void Bos(int i)
|
|
336
|
217
|
{
|
|
337
|
218
|
|
|
338
|
219
|
|
|
339
|
|
- for(int k=count-1; k > Store_bos_last_index ; k--)
|
|
|
220
|
+ for(int k=save_bullish_index; k > i ; k--)
|
|
340
|
221
|
{
|
|
341
|
222
|
high1 = iHigh(Symbol(),PERIOD_CURRENT,k);
|
|
342
|
223
|
if(high1 > high)
|
|
|
@@ -344,16 +225,10 @@ void Bos(int i)
|
|
344
|
225
|
|
|
345
|
226
|
high = high1;
|
|
346
|
227
|
index_of_high_time = iTime(Symbol(),PERIOD_CURRENT,k);
|
|
347
|
|
-
|
|
348
|
|
- //index_of_low = high_index- k;
|
|
349
|
|
-
|
|
350
|
228
|
bullish_found = false;
|
|
351
|
229
|
|
|
352
|
|
-
|
|
353
|
|
-
|
|
354
|
230
|
}
|
|
355
|
231
|
|
|
356
|
|
-
|
|
357
|
232
|
}
|
|
358
|
233
|
|
|
359
|
234
|
|
|
|
@@ -371,9 +246,6 @@ void Bos(int i)
|
|
371
|
246
|
}
|
|
372
|
247
|
|
|
373
|
248
|
|
|
374
|
|
-
|
|
375
|
|
- // Print("high is ", high);
|
|
376
|
|
- // Print("low is ", low);
|
|
377
|
249
|
low_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
378
|
250
|
|
|
379
|
251
|
|
|
|
@@ -688,6 +560,9 @@ void bos2(int i)
|
|
688
|
560
|
double find_high = 0.0;
|
|
689
|
561
|
datetime find_high_time = 0.0;
|
|
690
|
562
|
|
|
|
563
|
+ int save_bullish_index = 0;
|
|
|
564
|
+ int save_bearish_index = 0;
|
|
|
565
|
+
|
|
691
|
566
|
double find_low = 0.0;
|
|
692
|
567
|
datetime find_low_time = 0.0;
|
|
693
|
568
|
|
|
|
@@ -713,21 +588,30 @@ void bos2(int i)
|
|
713
|
588
|
{
|
|
714
|
589
|
if(checkCandle(m) == "Bullish")
|
|
715
|
590
|
{
|
|
|
591
|
+ save_bullish_index = m;
|
|
716
|
592
|
candle_bullish = true;
|
|
|
593
|
+ break;
|
|
717
|
594
|
}
|
|
718
|
595
|
}
|
|
719
|
|
- choch_index = iBarShift(Symbol(), PERIOD_CURRENT, choch_index_time, false);
|
|
720
|
596
|
|
|
721
|
|
- find_high = iHigh(Symbol(),PERIOD_CURRENT,choch_index);
|
|
722
|
|
- for(int j=choch_index; j>=i; j--)
|
|
723
|
|
- {
|
|
724
|
|
- double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
725
|
597
|
|
|
|
598
|
+ find_high = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
|
|
|
599
|
+ for(int m=save_bullish_index; m>i; m--)
|
|
|
600
|
+ {
|
|
|
601
|
+ double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
|
|
|
602
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
726
|
603
|
if(find_high < find_high1)
|
|
727
|
604
|
{
|
|
728
|
605
|
find_high = find_high1;
|
|
729
|
|
- find_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
606
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
730
|
607
|
}
|
|
|
608
|
+ }
|
|
|
609
|
+
|
|
|
610
|
+
|
|
|
611
|
+
|
|
|
612
|
+ for(int j=choch_index; j>=i; j--)
|
|
|
613
|
+ {
|
|
|
614
|
+
|
|
731
|
615
|
|
|
732
|
616
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
733
|
617
|
{
|
|
|
@@ -744,21 +628,27 @@ void bos2(int i)
|
|
744
|
628
|
{
|
|
745
|
629
|
if(checkCandle(m) == "Bullish")
|
|
746
|
630
|
{
|
|
|
631
|
+ save_bullish_index = m;
|
|
747
|
632
|
candle_bullish = true;
|
|
|
633
|
+ break;
|
|
748
|
634
|
}
|
|
749
|
635
|
}
|
|
750
|
|
- Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
751
|
636
|
|
|
752
|
|
- find_high = iHigh(Symbol(),PERIOD_CURRENT,Store_bos_last_index);
|
|
753
|
|
- for(int j=Store_bos_last_index; j>=i; j--)
|
|
754
|
|
- {
|
|
755
|
|
- double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,j);
|
|
756
|
637
|
|
|
|
638
|
+ find_high = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
|
|
|
639
|
+ for(int m=save_bullish_index; m>i; m--)
|
|
|
640
|
+ {
|
|
|
641
|
+ double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
|
|
|
642
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
757
|
643
|
if(find_high < find_high1)
|
|
758
|
644
|
{
|
|
759
|
645
|
find_high = find_high1;
|
|
760
|
|
- find_high_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
646
|
+ find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
761
|
647
|
}
|
|
|
648
|
+ }
|
|
|
649
|
+
|
|
|
650
|
+ for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
651
|
+ {
|
|
762
|
652
|
if(iClose(Symbol(),PERIOD_CURRENT,j) < iClose(Symbol(),PERIOD_CURRENT,i) || iLow(Symbol(),PERIOD_CURRENT,j) < iLow(Symbol(),PERIOD_CURRENT,i))
|
|
763
|
653
|
{
|
|
764
|
654
|
cnd = false;
|
|
|
@@ -780,6 +670,7 @@ void bos2(int i)
|
|
780
|
670
|
}
|
|
781
|
671
|
high = find_high;
|
|
782
|
672
|
index_of_high = iBarShift(Symbol(), PERIOD_CURRENT, find_high_time, false);
|
|
|
673
|
+ Print("time is ----------------------",find_high_time);
|
|
783
|
674
|
ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
|
|
784
|
675
|
ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
|
|
785
|
676
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
|
@@ -847,19 +738,29 @@ void bos2(int i)
|
|
847
|
738
|
{
|
|
848
|
739
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
849
|
740
|
candle_bearish = true;
|
|
|
741
|
+ save_bearish_index = m;
|
|
|
742
|
+ break;
|
|
850
|
743
|
}
|
|
851
|
744
|
}
|
|
852
|
|
- find_low = iLow(Symbol(),PERIOD_CURRENT,Store_bos_last_index);
|
|
853
|
|
- for(int j=Store_bos_last_index; j>=i; j--)
|
|
854
|
|
- {
|
|
855
|
745
|
|
|
856
|
|
- double find_low1 = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
|
746
|
+ find_low = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
|
|
857
|
747
|
|
|
|
748
|
+ for(int m=save_bearish_index; m>i; m--)
|
|
|
749
|
+ {
|
|
|
750
|
+ double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
|
|
|
751
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
858
|
752
|
if(find_low > find_low1)
|
|
859
|
753
|
{
|
|
860
|
754
|
find_low = find_low1;
|
|
861
|
|
- find_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
755
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
862
|
756
|
}
|
|
|
757
|
+ }
|
|
|
758
|
+
|
|
|
759
|
+
|
|
|
760
|
+ for(int j=Store_bos_last_index; j>=i; j--)
|
|
|
761
|
+ {
|
|
|
762
|
+
|
|
|
763
|
+
|
|
863
|
764
|
|
|
864
|
765
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
865
|
766
|
{
|
|
|
@@ -877,19 +778,24 @@ void bos2(int i)
|
|
877
|
778
|
{
|
|
878
|
779
|
// Print("found bearish at index ",iTime(Symbol(),PERIOD_CURRENT,m));
|
|
879
|
780
|
candle_bearish = true;
|
|
|
781
|
+ save_bearish_index = m;
|
|
|
782
|
+ break;
|
|
880
|
783
|
}
|
|
881
|
784
|
}
|
|
882
|
|
- find_low = iLow(Symbol(),PERIOD_CURRENT,choch_index);
|
|
883
|
|
- for(int j=choch_index; j>=i; j--)
|
|
884
|
|
- {
|
|
885
|
|
- double find_low1 = iLow(Symbol(),PERIOD_CURRENT,j);
|
|
|
785
|
+ find_low = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
|
|
886
|
786
|
|
|
|
787
|
+ for(int m=save_bearish_index; m>i; m--)
|
|
|
788
|
+ {
|
|
|
789
|
+ double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
|
|
|
790
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
887
|
791
|
if(find_low > find_low1)
|
|
888
|
792
|
{
|
|
889
|
793
|
find_low = find_low1;
|
|
890
|
|
- find_low_time = iTime(Symbol(),PERIOD_CURRENT,j);
|
|
|
794
|
+ find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
|
|
891
|
795
|
}
|
|
892
|
|
-
|
|
|
796
|
+ }
|
|
|
797
|
+ for(int j=choch_index; j>=i; j--)
|
|
|
798
|
+ {
|
|
893
|
799
|
if(iClose(Symbol(),PERIOD_CURRENT,j) > iClose(Symbol(),PERIOD_CURRENT,i) || iHigh(Symbol(),PERIOD_CURRENT,j) > iHigh(Symbol(),PERIOD_CURRENT,i))
|
|
894
|
800
|
{
|
|
895
|
801
|
cnd = false;
|
|
|
@@ -940,7 +846,7 @@ void bos2(int i)
|
|
940
|
846
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
941
|
847
|
|
|
942
|
848
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
943
|
|
- // Print(store_last_bos_index_time);
|
|
|
849
|
+ // Print(store_last_bos_index_time);
|
|
944
|
850
|
|
|
945
|
851
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
946
|
852
|
|
|
|
@@ -1010,8 +916,8 @@ void third_Condition(int i)
|
|
1010
|
916
|
if(high2 > high)
|
|
1011
|
917
|
{
|
|
1012
|
918
|
//third_condition_met = true;
|
|
1013
|
|
- // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
1014
|
|
- // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
919
|
+ // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
|
920
|
+ // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
1015
|
921
|
high = high2;
|
|
1016
|
922
|
|
|
1017
|
923
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -1044,7 +950,7 @@ void third_Condition(int i)
|
|
1044
|
950
|
{
|
|
1045
|
951
|
//third_condition_met = true;
|
|
1046
|
952
|
// ObjectCreate(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
|
|
1047
|
|
- // ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
953
|
+ // ObjectSetString(0,"line6"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
1048
|
954
|
|
|
1049
|
955
|
high = high2;
|
|
1050
|
956
|
|
|
|
@@ -1067,7 +973,7 @@ void third_Condition(int i)
|
|
1067
|
973
|
{
|
|
1068
|
974
|
third_condition_met = true;
|
|
1069
|
975
|
// ObjectCreate(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
1070
|
|
- // ObjectSetString(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
976
|
+ // ObjectSetString(0,"line61"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
1071
|
977
|
|
|
1072
|
978
|
low = low2;
|
|
1073
|
979
|
|
|
|
@@ -1195,7 +1101,7 @@ void foo(int value)
|
|
1195
|
1101
|
od_1[m].choch_index = -1;
|
|
1196
|
1102
|
|
|
1197
|
1103
|
}
|
|
1198
|
|
- // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1104
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1199
|
1105
|
|
|
1200
|
1106
|
|
|
1201
|
1107
|
}
|
|
|
@@ -1210,7 +1116,7 @@ void foo(int value)
|
|
1210
|
1116
|
|
|
1211
|
1117
|
}
|
|
1212
|
1118
|
//Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1213
|
|
- // Print(TimeCurrent());
|
|
|
1119
|
+ // Print(TimeCurrent());
|
|
1214
|
1120
|
//
|
|
1215
|
1121
|
// Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1216
|
1122
|
od_1[m].choch_index = -1;
|
|
|
@@ -1472,26 +1378,28 @@ int OnInit()
|
|
1472
|
1378
|
|
|
1473
|
1379
|
|
|
1474
|
1380
|
int idx = 0;
|
|
1475
|
|
-int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT,inpTime, false);
|
|
1476
|
|
-if(ObjectCreate(0,"line",OBJ_VLINE,0,inpTime,iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
1477
|
|
- {
|
|
1478
|
|
- Print("vertical line created on chart : ");
|
|
1479
|
|
- }
|
|
1480
|
|
-else
|
|
1481
|
|
- {
|
|
1482
|
|
- Print("error in creating line : ");
|
|
1483
|
|
- }
|
|
1484
|
1381
|
|
|
|
1382
|
+ int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT,inpTime, false);
|
|
|
1383
|
+ if(ObjectCreate(0,"line",OBJ_VLINE,0,inpTime,iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
1384
|
+ {
|
|
|
1385
|
+ Print("vertical line created on chart : ");
|
|
|
1386
|
+ }
|
|
|
1387
|
+ else
|
|
|
1388
|
+ {
|
|
|
1389
|
+ Print("error in creating line : ");
|
|
|
1390
|
+ }
|
|
|
1391
|
+
|
|
|
1392
|
+
|
|
|
1393
|
+//int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT, D'2022.09.01 15:30:27', false);
|
|
|
1394
|
+//if(ObjectCreate(0,"line",OBJ_VLINE,0,D'2022.09.01 15:30:27',iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
|
1395
|
+// {
|
|
|
1396
|
+// Print("object created on chart : ");
|
|
|
1397
|
+// }
|
|
|
1398
|
+//else
|
|
|
1399
|
+// {
|
|
|
1400
|
+// Print("object not created : ");
|
|
|
1401
|
+// }
|
|
1485
|
1402
|
|
|
1486
|
|
- //int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT, D'2022.09.01 15:30:27', false);
|
|
1487
|
|
- //if(ObjectCreate(0,"line",OBJ_VLINE,0,D'2022.09.01 15:30:27',iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
1488
|
|
- // {
|
|
1489
|
|
- // Print("object created on chart : ");
|
|
1490
|
|
- // }
|
|
1491
|
|
- //else
|
|
1492
|
|
- // {
|
|
1493
|
|
- // Print("object not created : ");
|
|
1494
|
|
- // }
|
|
1495
|
1403
|
object_find(object_name);
|
|
1496
|
1404
|
if(object_find(object_name) == true)
|
|
1497
|
1405
|
{
|