Sorry, I spent 14 min working with this and found only a couple of stocks that turn up in the scan results but don't belong. And I have no clue what the reason is. I did confirm those stocks will show up in the scan results when both time frames are include but also when only the 2 hour time frame is included. So there might be something wrong with the historical data for some stocks. What is really strange is that even the ParabolicSAR is on the wrong side for these invalid results.
Final note, there are MUCH simpler ways to check of the Hull moving average is trending up or down. Looking at your code I find no reason why such a complicated computation is required to find the direction of the Hull moving average. Seems to me to be a bit over-engineered. Remember that complexity breeds fragility. The most basic solutions are preferred and complexity should only be added when absolutely necessary.
For example the way the built-in study named "HullMovingAvg" changes the color based on direction is very basic:
HMA.AssignValueColor(if HMA > HMA[1] then HMA.color("Up") else HMA.color("Down"));
I am not suggesting that will fix the problem, but it sure is much easier to compute. (I ran way over time on this solution and don't have time to test it).