How to count the number of bars between two signals?

For example, over the past 100 days, 5 golden crosses have occured. I would like to count the number of bars between the 3rd and the 4th one from today. What functions should I apply?

You should be able to do it by calling ValueWhen() twice, using BarIndex() as the array.

2 Likes