Download MetaTrader 5

Why does ilowest skip many matches in a loop

To add comments, please log in or register
turtle1000
128
turtle1000  
  // This works,but ilowest below ,skips matches.
  &&  iLow(NULL,PERIOD_M1,ee4t)< iLow(NULL,PERIOD_M1,ee4t+2)
   &&  iLow(NULL,PERIOD_M1,ee4t)< iLow(NULL,PERIOD_M1,ee4t+1)
   &&  iLow(NULL,PERIOD_M1,ee4t)< iLow(NULL,PERIOD_M1,ee4t-1)
   &&  iLow(NULL,PERIOD_M1,ee4t)< iLow(NULL,PERIOD_M1,ee4t-2) 
 
  // ilowest skips many ee4t matches for the lowest 
// ee4t in an +1 incremented loop search in a several hundred
// bars search for matches within specific price ranges and
// 2 bars before and 2 after, ee4t.But the 4  // ilow statements above // find every 
// match every time. Have increased sleep time with no effect. And // have tested many examples. 

  && iLowest(NULL,PERIOD_M1,MODE_LOW,ee4t+2,ee4t-2)==ee4t 

Keith Watford
Moderator
9996
Keith Watford  

What do you mean? Skips matches?

 && iLowest(NULL,PERIOD_M1,MODE_LOW,ee4t+2,ee4t-2)==ee4t 

Maybe you mean

 && iLowest(NULL,PERIOD_M1,MODE_LOW,5,ee4t-2)==ee4t 

?

whroeder1
15023
whroeder1  
 && iLowest(NULL,PERIOD_M1,MODE_LOW,ee4t+2,ee4t-2)==ee4t 
Self documenting your code would generate a length of 5 as GumRai pointed out.
int iLast  = ee4t+2;
int iFirst = ee4t-2;
int length = iLast - iFirst + 1;

 && iLowest(NULL,PERIOD_M1,MODE_LOW,length,iFirst)==ee4t 
turtle1000
128
turtle1000  
WHRoeder:
Self documenting your code would generate a length of 5 as GumRai pointed out.

It works now...thanks again...
To add comments, please log in or register