I want to implement a very straightforward strategy:

”Once a day, locate 10 stocks (out of all US stocks) with highest price change during last 100 days”.

To my understanding, it means I need to maintain a rolling window of trade bars gor each US stock, and inside “OnData” - when I get a daily bar - to add it to relevant rolling window and then to calculate a change for each stock and then submit needed orders.

The “coarse filter” function needs to return all stocks from US market + all stocks I currently invested in (otherwise they will be removed from the universe and I will stop get trading bars for them in “OnData”).

 

Does everything described above makes sense or there is a better alternative? In my backtests everything works (arguably not fast as I would like to but I can live with that) but during live trading I getting exception from time to time something about “algorithm spent more than 10 minutes and hence terminated”. How to implement the strategy described above without getting into this issue?

 

 

Author

Evgeni Aizikovich

4 days ago