I don't see anything wrong with the counts. I checked a 1 month daily chart and a 3 month daily chart and the counts are correct. The only problem I can find is your first condition is set to zero. So when you have 25 true conditions on the 3 month daily chart the label shows 24. But as I said that is because your code is counting the first occurrence of the condition as zero instead of one.
I have included a screenshot that posts your condition as blue down arrows. You can count them yourself.
Not sure why your code references a daily time frame. Are you using this on an intraday chart and trying to read the counts from the daily time frame? If so, you need to make sure the intraday chart displays the same number of days as the daily chart you are comparing it too. This code cannot read data that is not displayed on the chart.