Explorar o código

Ticket # 1585

1) update the bos function change the direction of finding the bullish and bearish candel and update the high and low
2) fix the issue of drawing the high low trend lines on chart (candel time frame)
AhtashamShahzad3 %!s(int64=2) %!d(string=hai) anos
pai
achega
32699cc60b
Modificáronse 2 ficheiros con 13 adicións e 7 borrados
  1. BIN=BIN
      BOS_CHOCH.ex5
  2. 13 7
      BOS_CHOCH.mq5

BIN=BIN
BOS_CHOCH.ex5


+ 13 - 7
BOS_CHOCH.mq5

@@ -126,7 +126,7 @@ void Bos(int i)
       if(close > high)
         {
          high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
-         for(int j=high_index-1; j > i; j--)
+         for(int j = i  ; j < high_index ; j++)
            {
             if(checkCandle(j) == "Bearish")
               {
@@ -150,6 +150,7 @@ void Bos(int i)
 
                Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
 
+
                //low = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
 
                low =  iLow(Symbol(),PERIOD_CURRENT,j);
@@ -162,6 +163,7 @@ void Bos(int i)
 
            }
 
+
          if(bearish_found == true)
            {
 
@@ -213,7 +215,7 @@ void Bos(int i)
       if(close1 < low)
         {
          low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
-         for(int j=low_index - 1; j > i; j--)
+         for(int j= i ; j < low_index ; j++)
            {
             if(checkCandle(j) == "Bullish")
               {
@@ -1109,10 +1111,11 @@ void bos2(int i)
 
 
          find_high  = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
+         find_high_time = iTime(Symbol(),PERIOD_CURRENT,save_bullish_index); // here is the addition
          for(int m=save_bullish_index; m>i; m--)
            {
             double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
-            find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
+           // find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
             if(find_high < find_high1)
               {
                find_high = find_high1;
@@ -1149,10 +1152,11 @@ void bos2(int i)
 
 
          find_high  = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
+         find_high_time = iTime(Symbol(),PERIOD_CURRENT,save_bullish_index); // here is the addition
          for(int m=save_bullish_index; m>i; m--)
            {
             double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
-            find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
+           // find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
             if(find_high < find_high1)
               {
                find_high = find_high1;
@@ -1179,6 +1183,7 @@ void bos2(int i)
 
            }
          high = find_high;
+         high_index_time = find_high_time; // here is the addition
          index_of_high = iBarShift(Symbol(), PERIOD_CURRENT, find_high_time, false);
          ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
          ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
@@ -1243,11 +1248,11 @@ void bos2(int i)
            }
 
          find_low  = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
-
+         find_low_time = iTime(Symbol(),PERIOD_CURRENT,save_bearish_index); // here is the addition
          for(int m=save_bearish_index; m>i; m--)
            {
             double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
-            find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
+            //find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
             if(find_low > find_low1)
               {
                find_low = find_low1;
@@ -1278,7 +1283,7 @@ void bos2(int i)
               }
            }
          find_low  = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
-
+         find_low_time = iTime(Symbol(),PERIOD_CURRENT,save_bearish_index); // here is the addition
          for(int m=save_bearish_index; m>i; m--)
            {
             double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
@@ -1310,6 +1315,7 @@ void bos2(int i)
 
            }
          low = find_low;
+         low_index_time = find_low_time; // here is the addition 
          index_of_low = iBarShift(Symbol(), PERIOD_CURRENT, find_low_time, false);
          ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_low),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
          ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);