Came across this one - https://www.tradingview.com/script/qZRH ... nd-Filter/ - and seemed interesting. Used an Mladen's version of Sylvain Vervoort Bollinger Band indie as a basis ("sve bollinger band_main_mtf + alerts.mq4").
It basically counts how many times the price crosses the upper channel or the lower channel. The original version resets when the price crosses the opposite channel. I did add the option to reset the counter to 0 when the middle band is crossed, which could potentially indicate a ranging market. First impression is that this option is better set to FALSE when using "SVE BB" channel.
BB Channel with and without reset when middle band is crossed: