Browse Source

update bos function

AhtashamShahzad3 2 years ago
parent
commit
592a9dcfd2
2 changed files with 29 additions and 13 deletions
  1. BIN
      BOS_CHOCH.ex5
  2. 29 13
      BOS_CHOCH.mq5

BIN
BOS_CHOCH.ex5


+ 29 - 13
BOS_CHOCH.mq5

@@ -125,7 +125,7 @@ void Bos(int i)
125 125
   {
126 126
    int save_bullish_index = 0;
127 127
    int save_bearish_index = 0;
128
-
128
+   Print("trend is ",trend," high is ",high," low is ",low," low index is ",iTime(Symbol(),PERIOD_CURRENT,low_index)," high index is ",iTime(Symbol(),PERIOD_CURRENT,high_index));
129 129
 
130 130
    if(trend == "uptrend")
131 131
      {
@@ -134,13 +134,15 @@ void Bos(int i)
134 134
       if(close > high)
135 135
         {
136 136
          high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
137
-         for(int j = i  ; j < high_index ; j++)
137
+         Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
138
+         for(int j = i  ; j < Store_bos_last_index ; j++)
138 139
            {
139 140
             if(checkCandle(j) == "Bearish")
140 141
               {
141 142
                save_bullish_index = j;
142 143
                if(object_find("high") > 0)
143 144
                  {
145
+                  //Print(" in boss");
144 146
                   ObjectDelete(0,"high");
145 147
 
146 148
                  }
@@ -224,7 +226,8 @@ void Bos(int i)
224 226
       if(close1 < low)
225 227
         {
226 228
          low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
227
-         for(int j= i ; j < low_index ; j++)
229
+         Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
230
+         for(int j= i ; j < Store_bos_last_index ; j++)
228 231
            {
229 232
             if(checkCandle(j) == "Bullish")
230 233
               {
@@ -280,6 +283,7 @@ void Bos(int i)
280 283
 
281 284
             if(object_find("high") > 0)
282 285
               {
286
+               // Print(" in boss");
283 287
                ObjectDelete(0,"high");
284 288
 
285 289
               }
@@ -489,7 +493,7 @@ void Check_Inside_bar(int inex)
489 493
             //  Print("Target line deleted due to in bar ");
490 494
             if(object_find("target line") > 0)
491 495
               {
492
-              // Print("Target line deleted due to in bar ");
496
+               // Print("Target line deleted due to in bar ");
493 497
                ObjectDelete(0,"target line");
494 498
               }
495 499
 
@@ -510,7 +514,7 @@ void Check_Inside_bar(int inex)
510 514
             //   Print("Target line deleted due to in bar ");
511 515
             if(object_find("target line") > 0)
512 516
               {
513
-              // Print("Target line deleted due to in bar ");
517
+               // Print("Target line deleted due to in bar ");
514 518
                ObjectDelete(0,"target line");
515 519
               }
516 520
 
@@ -811,7 +815,7 @@ void choch(int i)
811 815
            }
812 816
 
813 817
          ObjectCreate(0,"target line",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,chock_index),iHigh(Symbol(),PERIOD_CURRENT,chock_index),iTime(Symbol(),PERIOD_CURRENT,0),iHigh(Symbol(),PERIOD_CURRENT,chock_index));
814
-           
818
+
815 819
 
816 820
          ObjectSetInteger(0,"target line",OBJPROP_RAY_RIGHT,true);
817 821
          ObjectSetInteger(0,"target line",OBJPROP_COLOR,clrGreen);
@@ -867,7 +871,7 @@ void choch(int i)
867 871
            {
868 872
             time_to_place_trade = 0.0;
869 873
             int current_time_frame = Period();
870
-            
874
+
871 875
             store_value_in_structure(choch_index_time,reversal_bar_time,signal,time_of_candle,time_to_place_trade,1,store_last_bos_index_time,store_Second_last_bos_index_time);
872 876
            }
873 877
 
@@ -941,6 +945,7 @@ void choch(int i)
941 945
 
942 946
          if(object_find("high") > 0)
943 947
            {
948
+            //Print(" in boss");
944 949
             ObjectDelete(0,"high");
945 950
 
946 951
            }
@@ -994,7 +999,7 @@ void choch(int i)
994 999
 
995 1000
          if(condition_not_match == true)
996 1001
            {
997
-           // Print("line target deleted :");
1002
+            // Print("line target deleted :");
998 1003
             HIGH = 0.0;
999 1004
             LOW = 0.0;
1000 1005
             tp_date_time_buy = 0.0;
@@ -1037,6 +1042,7 @@ void choch(int i)
1037 1042
 
1038 1043
          if(object_find("high") > 0)
1039 1044
            {
1045
+            //  Print(" in boss");
1040 1046
             ObjectDelete(0,"high");
1041 1047
 
1042 1048
            }
@@ -1171,6 +1177,7 @@ void bos2(int i)
1171 1177
 
1172 1178
          if(object_find("high") > 0)
1173 1179
            {
1180
+            //  Print(" in boss");
1174 1181
             ObjectDelete(0,"high");
1175 1182
 
1176 1183
            }
@@ -1315,6 +1322,7 @@ void bos2(int i)
1315 1322
 
1316 1323
          if(object_find("high") > 0)
1317 1324
            {
1325
+            // Print(" in boss");
1318 1326
             ObjectDelete(0,"high");
1319 1327
 
1320 1328
            }
@@ -1377,24 +1385,30 @@ void third_Condition(int i)
1377 1385
 
1378 1386
       if(high2 > high)
1379 1387
         {
1388
+         // Print("high 2 is ",high2," high is ",high);
1380 1389
          // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
1381 1390
          // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
1382 1391
          high = high2;
1383 1392
 
1384 1393
          high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
1385
-         high_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
1394
+         high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
1386 1395
 
1387
-         high_index = i;        // addtion to be minus
1396
+         // high_index = i;        // addtion to be minus
1388 1397
          if(object_find("high") > 0)
1389 1398
            {
1399
+            //   Print("Object find ");
1390 1400
             ObjectDelete(0,"high");
1391 1401
 
1392 1402
            }
1393 1403
 
1394
-         ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
1395
-         ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
1404
+         if(ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high2,iTime(Symbol(),PERIOD_CURRENT,0),high2))
1405
+           {
1406
+            //Print("Object created: ");
1407
+            ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
1408
+
1409
+            ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
1410
+           }
1396 1411
 
1397
-         ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
1398 1412
         }
1399 1413
 
1400 1414
 
@@ -1418,6 +1432,7 @@ void third_Condition(int i)
1418 1432
          high_index = i;      // addtion to be minus
1419 1433
          if(object_find("high") > 0)
1420 1434
            {
1435
+            // Print(" in boss");
1421 1436
             ObjectDelete(0,"high");
1422 1437
 
1423 1438
            }
@@ -1496,6 +1511,7 @@ void Entry_strategy(int value)
1496 1511
   {
1497 1512
    for(int i=value; i > 0; i--)
1498 1513
      {
1514
+      Print("time is ",iTime(Symbol(),PERIOD_CURRENT,i));
1499 1515
       Bos(i);
1500 1516
       //bos2(i);
1501 1517
       choch(i);