The function HH(10) is analysing the last 10 bars, whereas the system rules should analyse the last 10 days.

How did you align the bars to midnight?