Hi guys,

to build the Range bar I used the code below but the difference between H and L price is not always equal BarRange set.

Code:
var BarRange = 0.005;
//Range Bar
int bar(vars Open,vars High,vars Low,vars Close)
{
  if(Open[0] != Close[1]) {
    High[0] = max(Open[0],Close[1]);
    Low[0] = min(Open[0],Close[1]);
    Open[0] = Close[1];
  }
  if(High[0]-Low[0] >= BarRange)
    return 1;
  return 4;
}
function run()
{	
	set(PLOTNOW);
	StartDate = 20181001;
	EndDate = 2019;
	BarPeriod = 1;
	PlotScale = 12;	
	asset("EUR/AUD");
}



Can you help me to understand why?

Thanks