English

## Assistance requested: Determining the biggest range in previous 50 bars in 5 minute chart

 15 N22 2016.07.22 08:35   Hi, im having a small problem with developing a code to determine the ‘x’ value which is the index of the bar on the 5 minute chart with a range of 50 pips or more  between bar 1 and bar 8640. The Code keeps on returning a value of 1 even when the range of the bar with an index of 1 is less than 50 pips and even worse, the index of bar is supposed to be greater than 50. Please assist with any advice.```bool IdentifyBigBar()         //  Code for preventing High volatility { int  x; for( x=1;x<=8640; x++)   {    if ( (iHigh(NULL, PERIOD_M5, x) - iLow(NULL, PERIOD_M5, x) > 50*PipValue*Point)&&(x>50) )       break; Print("Index of the bar is",x);    return(true);   } } ```
 15 N22 2016.07.22 17:26 #   Hi rod178, '&&(x>50)'  is ensuring or supposed to ensure that my x value is greater than 50. I went on and tested what happens when I only have if (x>=50)  the code still returns a value of x=1 which doesn't make sense.```bool IdentifyBigBar()         //  Code for preventing High volatility { int  x; for( x=1;x<=8640; x++)   {    if ( (iHigh(NULL, PERIOD_M5, x) - iLow(NULL, PERIOD_M5, x) > 50*PipValue*Point)&&(x>=50) )       break; Print("Index of the bar is",x);    return(true);        } }```