Bladeren bron

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 2 jaren geleden
bovenliggende
commit
32699cc60b
2 gewijzigde bestanden met toevoegingen van 13 en 7 verwijderingen
  1. BIN
      BOS_CHOCH.ex5
  2. 13 7
      BOS_CHOCH.mq5

BIN
BOS_CHOCH.ex5


+ 13 - 7
BOS_CHOCH.mq5

@@ -126,7 +126,7 @@ void Bos(int i)
126 126
       if(close > high)
127 127
         {
128 128
          high_index = iBarShift(Symbol(), PERIOD_CURRENT, high_index_time, false);
129
-         for(int j=high_index-1; j > i; j--)
129
+         for(int j = i  ; j < high_index ; j++)
130 130
            {
131 131
             if(checkCandle(j) == "Bearish")
132 132
               {
@@ -150,6 +150,7 @@ void Bos(int i)
150 150
 
151 151
                Store_bos_last_index = iBarShift(Symbol(), PERIOD_CURRENT, store_last_bos_index_time, false);
152 152
 
153
+
153 154
                //low = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
154 155
 
155 156
                low =  iLow(Symbol(),PERIOD_CURRENT,j);
@@ -162,6 +163,7 @@ void Bos(int i)
162 163
 
163 164
            }
164 165
 
166
+
165 167
          if(bearish_found == true)
166 168
            {
167 169
 
@@ -213,7 +215,7 @@ void Bos(int i)
213 215
       if(close1 < low)
214 216
         {
215 217
          low_index = iBarShift(Symbol(), PERIOD_CURRENT, low_index_time, false);
216
-         for(int j=low_index - 1; j > i; j--)
218
+         for(int j= i ; j < low_index ; j++)
217 219
            {
218 220
             if(checkCandle(j) == "Bullish")
219 221
               {
@@ -1109,10 +1111,11 @@ void bos2(int i)
1109 1111
 
1110 1112
 
1111 1113
          find_high  = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
1114
+         find_high_time = iTime(Symbol(),PERIOD_CURRENT,save_bullish_index); // here is the addition
1112 1115
          for(int m=save_bullish_index; m>i; m--)
1113 1116
            {
1114 1117
             double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
1115
-            find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
1118
+           // find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
1116 1119
             if(find_high < find_high1)
1117 1120
               {
1118 1121
                find_high = find_high1;
@@ -1149,10 +1152,11 @@ void bos2(int i)
1149 1152
 
1150 1153
 
1151 1154
          find_high  = iHigh(Symbol(),PERIOD_CURRENT,save_bullish_index);
1155
+         find_high_time = iTime(Symbol(),PERIOD_CURRENT,save_bullish_index); // here is the addition
1152 1156
          for(int m=save_bullish_index; m>i; m--)
1153 1157
            {
1154 1158
             double find_high1 = iHigh(Symbol(),PERIOD_CURRENT,m);
1155
-            find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
1159
+           // find_high_time = iTime(Symbol(),PERIOD_CURRENT,m);
1156 1160
             if(find_high < find_high1)
1157 1161
               {
1158 1162
                find_high = find_high1;
@@ -1179,6 +1183,7 @@ void bos2(int i)
1179 1183
 
1180 1184
            }
1181 1185
          high = find_high;
1186
+         high_index_time = find_high_time; // here is the addition
1182 1187
          index_of_high = iBarShift(Symbol(), PERIOD_CURRENT, find_high_time, false);
1183 1188
          ObjectCreate(0,"high",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_high),high,iTime(Symbol(),PERIOD_CURRENT,0),high);
1184 1189
          ObjectSetInteger(0,"high",OBJPROP_RAY_RIGHT,true);
@@ -1243,11 +1248,11 @@ void bos2(int i)
1243 1248
            }
1244 1249
 
1245 1250
          find_low  = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
1246
-
1251
+         find_low_time = iTime(Symbol(),PERIOD_CURRENT,save_bearish_index); // here is the addition
1247 1252
          for(int m=save_bearish_index; m>i; m--)
1248 1253
            {
1249 1254
             double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
1250
-            find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
1255
+            //find_low_time = iTime(Symbol(),PERIOD_CURRENT,m);
1251 1256
             if(find_low > find_low1)
1252 1257
               {
1253 1258
                find_low = find_low1;
@@ -1278,7 +1283,7 @@ void bos2(int i)
1278 1283
               }
1279 1284
            }
1280 1285
          find_low  = iLow(Symbol(),PERIOD_CURRENT,save_bearish_index);
1281
-
1286
+         find_low_time = iTime(Symbol(),PERIOD_CURRENT,save_bearish_index); // here is the addition
1282 1287
          for(int m=save_bearish_index; m>i; m--)
1283 1288
            {
1284 1289
             double find_low1 = iLow(Symbol(),PERIOD_CURRENT,m);
@@ -1310,6 +1315,7 @@ void bos2(int i)
1310 1315
 
1311 1316
            }
1312 1317
          low = find_low;
1318
+         low_index_time = find_low_time; // here is the addition 
1313 1319
          index_of_low = iBarShift(Symbol(), PERIOD_CURRENT, find_low_time, false);
1314 1320
          ObjectCreate(0,"low",OBJ_TREND,0,iTime(Symbol(),PERIOD_CURRENT,index_of_low),low,iTime(Symbol(),PERIOD_CURRENT,0),low);
1315 1321
          ObjectSetInteger(0,"low",OBJPROP_RAY_RIGHT,true);