|
|
@@ -155,7 +155,7 @@ void Bos(int i)
|
|
155
|
155
|
ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
156
|
156
|
|
|
157
|
157
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
158
|
|
- Print(store_last_bos_index_time);
|
|
|
158
|
+ //Print(store_last_bos_index_time);
|
|
159
|
159
|
|
|
160
|
160
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
161
|
161
|
|
|
|
@@ -309,7 +309,7 @@ void Bos(int i)
|
|
309
|
309
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
310
|
310
|
|
|
311
|
311
|
|
|
312
|
|
- Print("last bos index is ",Store_bos_last_index);
|
|
|
312
|
+ // Print("last bos index is ",Store_bos_last_index);
|
|
313
|
313
|
|
|
314
|
314
|
//------
|
|
315
|
315
|
low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
|
|
|
@@ -412,10 +412,10 @@ void Entry_Action_1_down(int Store_bos_last_index, int i,int diff)
|
|
412
|
412
|
|
|
413
|
413
|
}
|
|
414
|
414
|
|
|
415
|
|
- Print("condition satisfied : ",check_values_less_than_choch_high(diff,i));
|
|
|
415
|
+ Print("condition satisfied in downtrend buy trade : ",check_values_less_than_choch_high(diff,i));
|
|
416
|
416
|
|
|
417
|
|
- Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
418
|
|
- Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
417
|
+// Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
418
|
+// Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
419
|
419
|
|
|
420
|
420
|
if(check_values_less_than_choch_high(diff,i) == true)
|
|
421
|
421
|
{
|
|
|
@@ -472,10 +472,10 @@ void Entry_Action_1_up(int Store_bos_last_index, int i,int diff)
|
|
472
|
472
|
}
|
|
473
|
473
|
//Print("diff is ", diff);
|
|
474
|
474
|
|
|
475
|
|
- Print("condition satisfied : ",check_values_less_than_choch_low(diff,i));
|
|
|
475
|
+ Print("condition satisfied in uptrend sell trade : ",check_values_less_than_choch_low(diff,i));
|
|
476
|
476
|
|
|
477
|
|
- Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
478
|
|
- Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
|
477
|
+// Print("choch candle open is ",iOpen(Symbol(),PERIOD_CURRENT,i));
|
|
|
478
|
+// Print("reversal candle open is ",iOpen(Symbol(),PERIOD_CURRENT,ind));
|
|
479
|
479
|
|
|
480
|
480
|
if(check_values_less_than_choch_low(diff,i) == true)
|
|
481
|
481
|
{
|
|
|
@@ -593,7 +593,7 @@ void choch(int i)
|
|
593
|
593
|
|
|
594
|
594
|
int diff1 = Store_bos_last_index - (i);
|
|
595
|
595
|
|
|
596
|
|
- Print("diff between bos and last choch is ",diff1);
|
|
|
596
|
+ // Print("diff between bos and last choch is ",diff1);
|
|
597
|
597
|
|
|
598
|
598
|
Entry_Action_1_up(Store_bos_last_index,i,diff1);
|
|
599
|
599
|
|
|
|
@@ -770,8 +770,8 @@ void bos2(int i)
|
|
770
|
770
|
if(cnd == true && candle_bullish == true)
|
|
771
|
771
|
{
|
|
772
|
772
|
|
|
773
|
|
- Print("high is --------------",find_high);
|
|
774
|
|
- Print("high time is --------------",find_high_time);
|
|
|
773
|
+ // Print("high is --------------",find_high);
|
|
|
774
|
+ // Print("high time is --------------",find_high_time);
|
|
775
|
775
|
|
|
776
|
776
|
if(object_find("high") > 0)
|
|
777
|
777
|
{
|
|
|
@@ -798,7 +798,7 @@ void bos2(int i)
|
|
798
|
798
|
|
|
799
|
799
|
|
|
800
|
800
|
ObjectCreate(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),low);
|
|
801
|
|
- ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos2");
|
|
|
801
|
+ ObjectSetString(0,"line2"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
802
|
802
|
|
|
803
|
803
|
|
|
804
|
804
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -904,8 +904,8 @@ void bos2(int i)
|
|
904
|
904
|
if(cnd == true && candle_bearish == true)
|
|
905
|
905
|
{
|
|
906
|
906
|
|
|
907
|
|
- Print("low is --------------",find_low);
|
|
908
|
|
- Print("low time is --------------",find_low_time);
|
|
|
907
|
+ // Print("low is --------------",find_low);
|
|
|
908
|
+ // Print("low time is --------------",find_low_time);
|
|
909
|
909
|
|
|
910
|
910
|
if(object_find("low") > 0)
|
|
911
|
911
|
{
|
|
|
@@ -937,10 +937,10 @@ void bos2(int i)
|
|
937
|
937
|
ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
|
|
938
|
938
|
|
|
939
|
939
|
ObjectCreate(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),high);
|
|
940
|
|
- ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos2");
|
|
|
940
|
+ ObjectSetString(0,"line1"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"bos");
|
|
941
|
941
|
|
|
942
|
942
|
store_last_bos_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
943
|
|
- Print(store_last_bos_index_time);
|
|
|
943
|
+ // Print(store_last_bos_index_time);
|
|
944
|
944
|
|
|
945
|
945
|
Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
|
|
946
|
946
|
|
|
|
@@ -985,8 +985,8 @@ void third_Condition(int i)
|
|
985
|
985
|
if(low2 < low)
|
|
986
|
986
|
{
|
|
987
|
987
|
third_condition_met = true;
|
|
988
|
|
- ObjectCreate(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
989
|
|
- ObjectSetString(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
|
988
|
+ // ObjectCreate(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iLow(Symbol(),PERIOD_CURRENT,i));
|
|
|
989
|
+ // ObjectSetString(0,"line5"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
|
|
990
|
990
|
low = low2;
|
|
991
|
991
|
|
|
992
|
992
|
low_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -1010,8 +1010,8 @@ void third_Condition(int i)
|
|
1010
|
1010
|
if(high2 > high)
|
|
1011
|
1011
|
{
|
|
1012
|
1012
|
//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");
|
|
|
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");
|
|
1015
|
1015
|
high = high2;
|
|
1016
|
1016
|
|
|
1017
|
1017
|
high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
@@ -1043,8 +1043,8 @@ void third_Condition(int i)
|
|
1043
|
1043
|
if(high2 > high)
|
|
1044
|
1044
|
{
|
|
1045
|
1045
|
//third_condition_met = true;
|
|
1046
|
|
- 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");
|
|
|
1046
|
+ // 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");
|
|
1048
|
1048
|
|
|
1049
|
1049
|
high = high2;
|
|
1050
|
1050
|
|
|
|
@@ -1066,8 +1066,8 @@ void third_Condition(int i)
|
|
1066
|
1066
|
if(low2 < low)
|
|
1067
|
1067
|
{
|
|
1068
|
1068
|
third_condition_met = true;
|
|
1069
|
|
- 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");
|
|
|
1069
|
+ // 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");
|
|
1071
|
1071
|
|
|
1072
|
1072
|
low = low2;
|
|
1073
|
1073
|
|
|
|
@@ -1136,130 +1136,172 @@ void foo(int value)
|
|
1136
|
1136
|
|
|
1137
|
1137
|
|
|
1138
|
1138
|
|
|
1139
|
|
- // if(signal == "buy" || signal == "sell")
|
|
1140
|
|
- // {
|
|
1141
|
|
- // MqlDateTime edate;
|
|
1142
|
|
- // time_to_place_trade = 0.0;
|
|
1143
|
|
- //
|
|
1144
|
|
- // //print("time of the candle ", time_of_candle);
|
|
1145
|
|
- //
|
|
1146
|
|
- // int current_time_frame = Period();
|
|
1147
|
|
- //
|
|
1148
|
|
- // string current_time_frame_string;
|
|
1149
|
|
- //
|
|
1150
|
|
- // switch(current_time_frame)
|
|
1151
|
|
- // {
|
|
1152
|
|
- //
|
|
1153
|
|
- // case PERIOD_M1:
|
|
1154
|
|
- // current_time_frame_string = "1 minute";
|
|
1155
|
|
- // break;
|
|
1156
|
|
- // case PERIOD_M5:
|
|
1157
|
|
- // current_time_frame_string = "5 minutes";
|
|
1158
|
|
- // break;
|
|
1159
|
|
- // case PERIOD_M15:
|
|
1160
|
|
- // current_time_frame_string = "15 minutes";
|
|
1161
|
|
- // break;
|
|
1162
|
|
- // case PERIOD_M30:
|
|
1163
|
|
- // current_time_frame_string = "30 minutes";
|
|
1164
|
|
- // break;
|
|
1165
|
|
- // case PERIOD_H1:
|
|
1166
|
|
- // current_time_frame_string = "1 hour";
|
|
1167
|
|
- //
|
|
1168
|
|
- //
|
|
1169
|
|
- // if(TimeToStruct(time_of_candle,edate))
|
|
1170
|
|
- // {
|
|
1171
|
|
- // edate.hour = edate.hour + 2;
|
|
1172
|
|
- // edate.min = 0;
|
|
1173
|
|
- // edate.sec = 0;
|
|
1174
|
|
- // }
|
|
1175
|
|
- //
|
|
1176
|
|
- //
|
|
1177
|
|
- // // print("hour of the candle is ",structtotime(edate));
|
|
1178
|
|
- // time_to_place_trade = StructToTime(edate);
|
|
1179
|
|
- //
|
|
1180
|
|
- //
|
|
1181
|
|
- //
|
|
1182
|
|
- // // for(int m=0; m < orderNum; m++)
|
|
1183
|
|
- // // {
|
|
1184
|
|
- // // if(od_1[m].choch_index != -1)
|
|
1185
|
|
- // // {
|
|
1186
|
|
- // // Print(" time to match the condition : ",TimeCurrent());
|
|
1187
|
|
- // //
|
|
1188
|
|
- // // if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
1189
|
|
- // // {
|
|
1190
|
|
- // // Print("time to match the condition : ",TimeCurrent());
|
|
1191
|
|
- // //
|
|
1192
|
|
- // // //if(ihigh(symbol(),period_current,od_1[m].reversal_index) > ilow(symbol(),period_current,0) && iclose(symbol(),period_current,od_1[m].choch_index) < iclose(symbol(),period_current,0))
|
|
1193
|
|
- // // {
|
|
1194
|
|
- // // ObjectCreate(0,"buy trade"+time_to_place_trade,OBJ_ARROW_BUY,0,time_to_place_trade,iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
1195
|
|
- // // Print("trade placed buy at index ",0);
|
|
1196
|
|
- // // od_1[m].choch_index = -1;
|
|
1197
|
|
- // //
|
|
1198
|
|
- // // }
|
|
1199
|
|
- // // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1200
|
|
- // //
|
|
1201
|
|
- // //
|
|
1202
|
|
- // // }
|
|
1203
|
|
- // //
|
|
1204
|
|
- // // if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
1205
|
|
- // // {
|
|
1206
|
|
- // // Print(TimeCurrent());
|
|
1207
|
|
- // // //
|
|
1208
|
|
- // // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1209
|
|
- // // od_1[m].choch_index = -1;
|
|
1210
|
|
- // //
|
|
1211
|
|
- // // }
|
|
1212
|
|
- // // }
|
|
1213
|
|
- // // }
|
|
1214
|
|
- //
|
|
1215
|
|
- //
|
|
1216
|
|
- //
|
|
1217
|
|
- // // if(timecurrent() >= time_to_place_trade)
|
|
1218
|
|
- // // {
|
|
1219
|
|
- // // print("hi");
|
|
1220
|
|
- // // if(signal == "buy")
|
|
1221
|
|
- // // {
|
|
1222
|
|
- // // int index = ibarshift(symbol(), period_current, time_of_candle, false);
|
|
1223
|
|
- // // print("index of the 2 hour plus index is ",index);
|
|
1224
|
|
- // //
|
|
1225
|
|
- // // print("choch index ", i);
|
|
1226
|
|
- // // print("reversal index ",ind);
|
|
1227
|
|
- // // print("value to be check index ",i-3);
|
|
1228
|
|
- // //
|
|
1229
|
|
- // // //if(ihigh(symbol(),period_current,ind) > ilow(symbol(),period_current,i-2) && iclose(symbol(),period_current,i) < iclose(symbol(),period_current,i-2))
|
|
1230
|
|
- // // // {
|
|
1231
|
|
- // // // objectcreate(0,"buy trade"+time_to_place_trade,obj_arrow_buy,0,time_to_place_trade,ihigh(symbol(),period_current,i-3));
|
|
1232
|
|
- // // // print("trade placed buy at index ",i-3);
|
|
1233
|
|
- // // // }
|
|
1234
|
|
- // // print(time_to_place_trade);
|
|
1235
|
|
- // //
|
|
1236
|
|
- // // }
|
|
1237
|
|
- // // if(signal == "sell")
|
|
1238
|
|
- // // {
|
|
1239
|
|
- // // print("trade placed ");
|
|
1240
|
|
- // // objectcreate(0,"sell trade"+time_to_place_trade,obj_arrow_sell,0,time_to_place_trade,ilow(symbol(),period_current,i-3));
|
|
1241
|
|
- // //
|
|
1242
|
|
- // // print(ind);
|
|
1243
|
|
- // // print(time_to_place_trade);
|
|
1244
|
|
- // // }
|
|
1245
|
|
- // // }
|
|
1246
|
|
- // //else
|
|
1247
|
|
- // // {
|
|
1248
|
|
- // // time_of_candle = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
1249
|
|
- // // }
|
|
1250
|
|
- //
|
|
1251
|
|
- // break;
|
|
1252
|
|
- //
|
|
1253
|
|
- // default:
|
|
1254
|
|
- // current_time_frame_string = "unknown";
|
|
1255
|
|
- // break;
|
|
1256
|
|
- // }
|
|
1257
|
|
- //
|
|
1258
|
|
- // //print("current timeframe: ", current_time_frame_string);
|
|
1259
|
|
- //
|
|
1260
|
|
- //
|
|
1261
|
|
- // signal = "";
|
|
1262
|
|
- // }
|
|
|
1139
|
+ if(signal == "buy" || signal == "sell")
|
|
|
1140
|
+ {
|
|
|
1141
|
+ MqlDateTime edate;
|
|
|
1142
|
+ time_to_place_trade = 0.0;
|
|
|
1143
|
+
|
|
|
1144
|
+ //print("time of the candle ", time_of_candle);
|
|
|
1145
|
+
|
|
|
1146
|
+ int current_time_frame = Period();
|
|
|
1147
|
+
|
|
|
1148
|
+ string current_time_frame_string;
|
|
|
1149
|
+
|
|
|
1150
|
+ switch(current_time_frame)
|
|
|
1151
|
+ {
|
|
|
1152
|
+
|
|
|
1153
|
+ case PERIOD_M1:
|
|
|
1154
|
+ current_time_frame_string = "1 minute";
|
|
|
1155
|
+ break;
|
|
|
1156
|
+ case PERIOD_M5:
|
|
|
1157
|
+ current_time_frame_string = "5 minutes";
|
|
|
1158
|
+ break;
|
|
|
1159
|
+ case PERIOD_M15:
|
|
|
1160
|
+ current_time_frame_string = "15 minutes";
|
|
|
1161
|
+ break;
|
|
|
1162
|
+ case PERIOD_M30:
|
|
|
1163
|
+ current_time_frame_string = "30 minutes";
|
|
|
1164
|
+ break;
|
|
|
1165
|
+ case PERIOD_H1:
|
|
|
1166
|
+ current_time_frame_string = "1 hour";
|
|
|
1167
|
+
|
|
|
1168
|
+
|
|
|
1169
|
+ if(TimeToStruct(time_of_candle,edate))
|
|
|
1170
|
+ {
|
|
|
1171
|
+ edate.hour = edate.hour + 2;
|
|
|
1172
|
+ edate.min = 0;
|
|
|
1173
|
+ edate.sec = 0;
|
|
|
1174
|
+ }
|
|
|
1175
|
+
|
|
|
1176
|
+
|
|
|
1177
|
+ // print("hour of the candle is ",structtotime(edate));
|
|
|
1178
|
+ time_to_place_trade = StructToTime(edate);
|
|
|
1179
|
+ store_value_in_structure(i,ind,signal,time_of_candle,time_to_place_trade);
|
|
|
1180
|
+
|
|
|
1181
|
+ for(int m=0; m < orderNum; m++)
|
|
|
1182
|
+ {
|
|
|
1183
|
+ if(od_1[m].choch_index != -1)
|
|
|
1184
|
+ {
|
|
|
1185
|
+ //Print(" time to match the condition : ",TimeCurrent());
|
|
|
1186
|
+
|
|
|
1187
|
+ if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
1188
|
+ {
|
|
|
1189
|
+ //Print("time to match the condition : ",TimeCurrent());
|
|
|
1190
|
+
|
|
|
1191
|
+ if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
1192
|
+ {
|
|
|
1193
|
+ ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
1194
|
+ //Print("trade placed buy at index ",0);
|
|
|
1195
|
+ od_1[m].choch_index = -1;
|
|
|
1196
|
+
|
|
|
1197
|
+ }
|
|
|
1198
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1199
|
+
|
|
|
1200
|
+
|
|
|
1201
|
+ }
|
|
|
1202
|
+
|
|
|
1203
|
+ if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
1204
|
+ {
|
|
|
1205
|
+ if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) < iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) > iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
1206
|
+ {
|
|
|
1207
|
+ ObjectCreate(0,"sell trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iLow(Symbol(),PERIOD_CURRENT,0));
|
|
|
1208
|
+ //Print("trade placed sell at index ",0);
|
|
|
1209
|
+ od_1[m].choch_index = -1;
|
|
|
1210
|
+
|
|
|
1211
|
+ }
|
|
|
1212
|
+ //Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1213
|
+ // Print(TimeCurrent());
|
|
|
1214
|
+ //
|
|
|
1215
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1216
|
+ od_1[m].choch_index = -1;
|
|
|
1217
|
+
|
|
|
1218
|
+ }
|
|
|
1219
|
+ }
|
|
|
1220
|
+ }
|
|
|
1221
|
+
|
|
|
1222
|
+
|
|
|
1223
|
+
|
|
|
1224
|
+ // for(int m=0; m < orderNum; m++)
|
|
|
1225
|
+ // {
|
|
|
1226
|
+ // if(od_1[m].choch_index != -1)
|
|
|
1227
|
+ // {
|
|
|
1228
|
+ // Print(" time to match the condition : ",TimeCurrent());
|
|
|
1229
|
+ //
|
|
|
1230
|
+ // if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
1231
|
+ // {
|
|
|
1232
|
+ // Print("time to match the condition : ",TimeCurrent());
|
|
|
1233
|
+ //
|
|
|
1234
|
+ // //if(ihigh(symbol(),period_current,od_1[m].reversal_index) > ilow(symbol(),period_current,0) && iclose(symbol(),period_current,od_1[m].choch_index) < iclose(symbol(),period_current,0))
|
|
|
1235
|
+ // {
|
|
|
1236
|
+ // ObjectCreate(0,"buy trade"+time_to_place_trade,OBJ_ARROW_BUY,0,time_to_place_trade,iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
1237
|
+ // Print("trade placed buy at index ",0);
|
|
|
1238
|
+ // od_1[m].choch_index = -1;
|
|
|
1239
|
+ //
|
|
|
1240
|
+ // }
|
|
|
1241
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1242
|
+ //
|
|
|
1243
|
+ //
|
|
|
1244
|
+ // }
|
|
|
1245
|
+ //
|
|
|
1246
|
+ // if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
1247
|
+ // {
|
|
|
1248
|
+ // Print(TimeCurrent());
|
|
|
1249
|
+ // //
|
|
|
1250
|
+ // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1251
|
+ // od_1[m].choch_index = -1;
|
|
|
1252
|
+ //
|
|
|
1253
|
+ // }
|
|
|
1254
|
+ // }
|
|
|
1255
|
+ // }
|
|
|
1256
|
+
|
|
|
1257
|
+
|
|
|
1258
|
+
|
|
|
1259
|
+ // if(timecurrent() >= time_to_place_trade)
|
|
|
1260
|
+ // {
|
|
|
1261
|
+ // print("hi");
|
|
|
1262
|
+ // if(signal == "buy")
|
|
|
1263
|
+ // {
|
|
|
1264
|
+ // int index = ibarshift(symbol(), period_current, time_of_candle, false);
|
|
|
1265
|
+ // print("index of the 2 hour plus index is ",index);
|
|
|
1266
|
+ //
|
|
|
1267
|
+ // print("choch index ", i);
|
|
|
1268
|
+ // print("reversal index ",ind);
|
|
|
1269
|
+ // print("value to be check index ",i-3);
|
|
|
1270
|
+ //
|
|
|
1271
|
+ // //if(ihigh(symbol(),period_current,ind) > ilow(symbol(),period_current,i-2) && iclose(symbol(),period_current,i) < iclose(symbol(),period_current,i-2))
|
|
|
1272
|
+ // // {
|
|
|
1273
|
+ // // objectcreate(0,"buy trade"+time_to_place_trade,obj_arrow_buy,0,time_to_place_trade,ihigh(symbol(),period_current,i-3));
|
|
|
1274
|
+ // // print("trade placed buy at index ",i-3);
|
|
|
1275
|
+ // // }
|
|
|
1276
|
+ // print(time_to_place_trade);
|
|
|
1277
|
+ //
|
|
|
1278
|
+ // }
|
|
|
1279
|
+ // if(signal == "sell")
|
|
|
1280
|
+ // {
|
|
|
1281
|
+ // print("trade placed ");
|
|
|
1282
|
+ // objectcreate(0,"sell trade"+time_to_place_trade,obj_arrow_sell,0,time_to_place_trade,ilow(symbol(),period_current,i-3));
|
|
|
1283
|
+ //
|
|
|
1284
|
+ // print(ind);
|
|
|
1285
|
+ // print(time_to_place_trade);
|
|
|
1286
|
+ // }
|
|
|
1287
|
+ // }
|
|
|
1288
|
+ //else
|
|
|
1289
|
+ // {
|
|
|
1290
|
+ // time_of_candle = iTime(Symbol(),PERIOD_CURRENT,i);
|
|
|
1291
|
+ // }
|
|
|
1292
|
+
|
|
|
1293
|
+ break;
|
|
|
1294
|
+
|
|
|
1295
|
+ default:
|
|
|
1296
|
+ current_time_frame_string = "unknown";
|
|
|
1297
|
+ break;
|
|
|
1298
|
+ }
|
|
|
1299
|
+
|
|
|
1300
|
+ //print("current timeframe: ", current_time_frame_string);
|
|
|
1301
|
+
|
|
|
1302
|
+
|
|
|
1303
|
+ signal = "";
|
|
|
1304
|
+ }
|
|
1263
|
1305
|
|
|
1264
|
1306
|
|
|
1265
|
1307
|
|
|
|
@@ -1430,26 +1472,26 @@ int OnInit()
|
|
1430
|
1472
|
|
|
1431
|
1473
|
|
|
1432
|
1474
|
int idx = 0;
|
|
1433
|
|
-//int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT,inpTime, false);
|
|
1434
|
|
-//if(ObjectCreate(0,"line",OBJ_VLINE,0,inpTime,iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
1435
|
|
-// {
|
|
1436
|
|
-// Print("vertical line created on chart : ");
|
|
1437
|
|
-// }
|
|
1438
|
|
-//else
|
|
1439
|
|
-// {
|
|
1440
|
|
-// Print("error in creating line : ");
|
|
1441
|
|
-// }
|
|
1442
|
|
-
|
|
1443
|
|
-
|
|
1444
|
|
- int user_input_index = iBarShift(Symbol(), PERIOD_CURRENT, D'2022.09.01 15:30:27', false);
|
|
1445
|
|
- if(ObjectCreate(0,"line",OBJ_VLINE,0,D'2022.09.01 15:30:27',iLow(Symbol(),PERIOD_CURRENT,user_input_index)))
|
|
1446
|
|
- {
|
|
1447
|
|
- Print("object created on chart : ");
|
|
1448
|
|
- }
|
|
1449
|
|
- else
|
|
1450
|
|
- {
|
|
1451
|
|
- Print("object not created : ");
|
|
1452
|
|
- }
|
|
|
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
|
+
|
|
|
1485
|
+
|
|
|
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
|
+ // }
|
|
1453
|
1495
|
object_find(object_name);
|
|
1454
|
1496
|
if(object_find(object_name) == true)
|
|
1455
|
1497
|
{
|
|
|
@@ -1561,38 +1603,38 @@ void OnTick()
|
|
1561
|
1603
|
|
|
1562
|
1604
|
|
|
1563
|
1605
|
|
|
1564
|
|
- for(int m=0; m < orderNum; m++)
|
|
1565
|
|
- {
|
|
1566
|
|
- if(od_1[m].choch_index != -1)
|
|
1567
|
|
- {
|
|
1568
|
|
- //Print(" time to match the condition : ",TimeCurrent());
|
|
1569
|
|
-
|
|
1570
|
|
- if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
1571
|
|
- {
|
|
1572
|
|
- //Print("time to match the condition : ",TimeCurrent());
|
|
1573
|
|
-
|
|
1574
|
|
- if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
1575
|
|
- {
|
|
1576
|
|
- ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
1577
|
|
- Print("trade placed buy at index ",0);
|
|
1578
|
|
- od_1[m].choch_index = -1;
|
|
1579
|
|
-
|
|
1580
|
|
- }
|
|
1581
|
|
- Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1582
|
|
-
|
|
1583
|
|
-
|
|
1584
|
|
- }
|
|
1585
|
|
-
|
|
1586
|
|
- if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
1587
|
|
- {
|
|
1588
|
|
- Print(TimeCurrent());
|
|
1589
|
|
- //
|
|
1590
|
|
- // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
1591
|
|
- od_1[m].choch_index = -1;
|
|
1592
|
|
-
|
|
1593
|
|
- }
|
|
1594
|
|
- }
|
|
1595
|
|
- }
|
|
|
1606
|
+// for(int m=0; m < orderNum; m++)
|
|
|
1607
|
+// {
|
|
|
1608
|
+// if(od_1[m].choch_index != -1)
|
|
|
1609
|
+// {
|
|
|
1610
|
+// //Print(" time to match the condition : ",TimeCurrent());
|
|
|
1611
|
+//
|
|
|
1612
|
+// if(TimeCurrent() > od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "buy")
|
|
|
1613
|
+// {
|
|
|
1614
|
+// //Print("time to match the condition : ",TimeCurrent());
|
|
|
1615
|
+//
|
|
|
1616
|
+// if(iHigh(Symbol(),PERIOD_CURRENT,od_1[m].reversal_index) > iLow(Symbol(),PERIOD_CURRENT,0) && iClose(Symbol(),PERIOD_CURRENT,od_1[m].choch_index) < iClose(Symbol(),PERIOD_CURRENT,0))
|
|
|
1617
|
+// {
|
|
|
1618
|
+// ObjectCreate(0,"buy trade"+TimeCurrent(),OBJ_ARROW_BUY,0,TimeCurrent(),iHigh(Symbol(),PERIOD_CURRENT,0));
|
|
|
1619
|
+// Print("trade placed buy at index ",0);
|
|
|
1620
|
+// od_1[m].choch_index = -1;
|
|
|
1621
|
+//
|
|
|
1622
|
+// }
|
|
|
1623
|
+// Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1624
|
+//
|
|
|
1625
|
+//
|
|
|
1626
|
+// }
|
|
|
1627
|
+//
|
|
|
1628
|
+// if(TimeCurrent() >= od_1[m].Time_of_candle_For_trade && od_1[m].Signal == "sell")
|
|
|
1629
|
+// {
|
|
|
1630
|
+// Print(TimeCurrent());
|
|
|
1631
|
+// //
|
|
|
1632
|
+// // Print(" time to take trade is ",od_1[m].Time_of_candle_For_trade);
|
|
|
1633
|
+// od_1[m].choch_index = -1;
|
|
|
1634
|
+//
|
|
|
1635
|
+// }
|
|
|
1636
|
+// }
|
|
|
1637
|
+// }
|
|
1596
|
1638
|
|
|
1597
|
1639
|
}
|
|
1598
|
1640
|
|