What mistake I made in this indicator ?

 

Hi 

I find an indicator that shows the Pin Bars of a symbol , and I modify it to show only the Bullish Pin Bars who is  above an Up Ma and the Bearish Pin Bars who is below a down Ma . 

And when I drop it to a chart with 4H timeframe or less it shows nothing , but with a D1 timeframe or bigger it works but only for the Bullish Pin Bars :( . Who's can help me , thanks .

Files:
Reason: