Hi, I am new to writing algos here. Here is the area I would like some help.

- Let's say I am using ROC to measure momentum and I want to buy SPY as long as ROC is positive over a lookback. 

- The way I want to trade this is that at the end of the day, say 5 mins before market closes, I want to use the 3:55 PM (EST) market data to calculate ROC over the lookback and place trades before market closes.

- So, instead of taking signal at the end of the day and trading in the next open, we take signal 5 mins before the close and trade it.

I have attached a simple backtest. Appreciate your help!