Hi Community,

I'm revising the Open Range Breakout strategy to long SPY if current price of SPY crosses above the last 30 min bar in the pre-market (9-9:30am). I try to create a rolling window that stores the current 30min bar and the previous 30 min bar. I want to exit the trade if current price of SPY crosses below the previous 30min bar low. But somehow the algorithm only knows how to enter the trade but the exit function does not work properly. Could someone help me out and point out where I did wrong? 

Many thanks!