I have repeatedly seen traders clamoring for an indicator that counts consecutive up and down candles (bars) in the Forum. Clearly, many traders use, or want to use, that indicator. Although I've seen various options for MT4, options for MT5 appear to be limited. The consecutive bar counting indicators that I found merely show the current count of consecutive bars that print in the current price direction. Therefore, I coded this Consecutive_Bars indicator for MT5.

The main benefit of this indicator is that you can set a level at the most frequently appearing "false swing" count─thereby filtering those false swings out of your trading. The blue line study shows up bars, and the red line study shows down bars. Upon 1 bar printing in the opposite direction of the count, the line studies (respectively) return to the 0 level.

The indicator has been updated to version 1.50 which includes 2 moving averages for determining where price has exceeded the average count of consecutive up bars, and where price has exceeded the average count of consecutive down bars, respectively. Indicator flicker and a stack overflow error has been fixed in version as well. Zero values are ignored by the moving average calculations. It's more sensible to exclude the bars that are not up bars from the average consecutive up bars number, and the same for down bars. General efficiency improved as well.