How to calculate number of days until specific price change?


Hoping to get some help programming this indicator, would be great!

The goal is to identify every how often there's a big (user defined) daily price change, let's say 10%.

The indicator would calculate the number of days (from the beginning of the period) it took to reach a 10% daily price change. Let's say that it happened in 15 days... the system would display the 15 days on the bar where the condition is true and it would also display the actual price change.

Once the event is true, it starts counting again until the condition is met again. Let's say this time it took 25 days to experience at least a 10% daily price change... so again it would display the 25 days on the true bar... along with the actual % change... and the indicator would track a running total of the frequency of true events for the time period.

Thanks a lot for your help in advance!