Hello everyone. I'm very new and trying to write a simple channel breakout algo where I go long when price is higher than the highest high of the previous 5 bars and short when price goes lower than the lowest low of the previous 5 bars. My desired timeframe is the 1 minute chart. 

I've gotten my code to work without errors now but when I backtest over a week there are many less trades than I would expect. I'm trying to duplicate the pinescript shown (except with length of 5) which over 2 weeks shows over 1000 trades. 

What am I doing wrong? Thanks!