Hi, is there a built in indicator that gives the time periods since a given range (high-low) occurred? Something like the inverse of average true range, but without time averaging.

So one might give an input of 0.01 as a 1 cent move for EUR/USD, and the number of time periods to the first time High-Low exceeded 1 cent is returned.

I tried to code this in an indicator using:
int i=1; var HL=0.0;
while(HL<0.01) {
HL=HH(Data[i])-LL(Data[i];
i=i+1; }
return (i-1)

However, this hung Zorro, and even when I tried with 4 hour data for just a few months, Zorro still hung with the message "compiling.........."

Thanks for any guidance.