AhtashamShahzad3 2 лет назад
Родитель
Сommit
592a9dcfd2
2 измененных файлов с 29 добавлено и 13 удалено
  1. BIN
      BOS_CHOCH.ex5
  2. 29 13
      BOS_CHOCH.mq5

+ 29 - 13
BOS_CHOCH.mq5

@@ -125,7 +125,7 @@ void Bos(int i)
   {
    int save_bullish_index = 0;
    int save_bearish_index = 0;
-
+   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));
 
    if(trend == "uptrend")
      {
@@ -134,13 +134,15 @@ void Bos(int i)
       if(close > high)
         {
          high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
-         for(int j = i  ; j < high_index ; j++)
+         Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
+         for(int j = i  ; j < Store_bos_last_index ; j++)
            {
             if(checkCandle(j) == "Bearish")
               {
                save_bullish_index = j;
                if(object_find("high") > 0)
                  {
+                  //Print(" in boss");
                   ObjectDelete(0,"high");
 
                  }
@@ -224,7 +226,8 @@ void Bos(int i)
       if(close1 < low)
         {
          low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
-         for(int j= i ; j < low_index ; j++)
+         Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
+         for(int j= i ; j < Store_bos_last_index ; j++)
            {
             if(checkCandle(j) == "Bullish")
               {
@@ -280,6 +283,7 @@ void Bos(int i)
 
             if(object_find("high") > 0)
               {
+               // Print(" in boss");
                ObjectDelete(0,"high");
 
               }
@@ -489,7 +493,7 @@ void Check_Inside_bar(int inex)
             //  Print("Target line deleted due to in bar ");
             if(object_find("target line") > 0)
               {
-              // Print("Target line deleted due to in bar ");
+               // Print("Target line deleted due to in bar ");
                ObjectDelete(0,"target line");
               }
 
@@ -510,7 +514,7 @@ void Check_Inside_bar(int inex)
             //   Print("Target line deleted due to in bar ");
             if(object_find("target line") > 0)
               {
-              // Print("Target line deleted due to in bar ");
+               // Print("Target line deleted due to in bar ");
                ObjectDelete(0,"target line");
               }
 
@@ -811,7 +815,7 @@ void choch(int i)
            }
 
          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));
-           
+
 
          ObjectSetInteger(0,"target line",OBJPROP_RAY_RIGHT,true);
          ObjectSetInteger(0,"target line",OBJPROP_COLOR,clrGreen);
@@ -867,7 +871,7 @@ void choch(int i)
            {
             time_to_place_trade = 0.0;
             int current_time_frame = Period();
-            
+
             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);
            }
 
@@ -941,6 +945,7 @@ void choch(int i)
 
          if(object_find("high") > 0)
            {
+            //Print(" in boss");
             ObjectDelete(0,"high");
 
            }
@@ -994,7 +999,7 @@ void choch(int i)
 
          if(condition_not_match == true)
            {
-           // Print("line target deleted :");
+            // Print("line target deleted :");
             HIGH = 0.0;
             LOW = 0.0;
             tp_date_time_buy = 0.0;
@@ -1037,6 +1042,7 @@ void choch(int i)
 
          if(object_find("high") > 0)
            {
+            //  Print(" in boss");
             ObjectDelete(0,"high");
 
            }
@@ -1171,6 +1177,7 @@ void bos2(int i)
 
          if(object_find("high") > 0)
            {
+            //  Print(" in boss");
             ObjectDelete(0,"high");
 
            }
@@ -1315,6 +1322,7 @@ void bos2(int i)
 
          if(object_find("high") > 0)
            {
+            // Print(" in boss");
             ObjectDelete(0,"high");
 
            }
@@ -1377,24 +1385,30 @@ void third_Condition(int i)
 
       if(high2 > high)
         {
+         // Print("high 2 is ",high2," high is ",high);
          // ObjectCreate(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i),OBJ_TEXT,0,iTime(Symbol(),PERIOD_CURRENT,i),iHigh(Symbol(),PERIOD_CURRENT,i));
          // ObjectSetString(0,"line51"+iTime(Symbol(),PERIOD_CURRENT,i), OBJPROP_TEXT,"3_C");
          high = high2;
 
          high_index_time = iTime(Symbol(),PERIOD_CURRENT,i);
-         high_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
+         high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
 
-         high_index = i;        // addtion to be minus
+         // high_index = i;        // addtion to be minus
          if(object_find("high") > 0)
            {
+            //   Print("Object find ");
             ObjectDelete(0,"high");
 
            }
 
-         ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
-         ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
+         if(ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,i),high2,iTime(Symbol(),PERIOD_CURRENT,0),high2))
+           {
+            //Print("Object created: ");
+            ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
+
+            ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
+           }
 
-         ObjectSetInteger(0,"high",OBJPROP_COLOR,clrBlue);
         }
 
 
@@ -1418,6 +1432,7 @@ void third_Condition(int i)
          high_index = i;      // addtion to be minus
          if(object_find("high") > 0)
            {
+            // Print(" in boss");
             ObjectDelete(0,"high");
 
            }
@@ -1496,6 +1511,7 @@ void Entry_strategy(int value)
   {
    for(int i=value; i > 0; i--)
      {
+      Print("time is ",iTime(Symbol(),PERIOD_CURRENT,i));
       Bos(i);
       //bos2(i);
       choch(i);