This algorithm came out of a discussion on https://www.quantopian.com/posts/how-do-i-shift-the-moving-average-of-an-imported-csv-chart.
Basic outline:
- For development, set:
set_commission(commission.PerShare(cost=0))
set_slippage(slippage.FixedSlippage(spread=0.00))
- Consider a list of 100 securities (the Nasdaq 100, I think)
- Using a 30-day trailing window, compute the difference (gap) between the daily opening price and the prior daily closing price
- Normalize the gap using a z-score
- Each day, identify the pair of stocks corresponding to the min and max gap z-scores
- Buy the stock with the min gap z-score, and short the stock with the max gap z-score
- After 3 pm, close open positions
Comments/questions/improvements welcome.
Grant