Simple momentum algorithm. Got the rules from a book by Laurens Bensdorp.
Objective:
- Trade long only, a big index, mainly blue-chip stocks that rise in value.
- Execute trades once a week. Catch big trending stocks, expecting they will continue to rise.
- Outperform the S&P 500 with lower drawdowns in bear markets.
Trading universe:
- S&P 500. As Quantopian does not provide it directly, found something similar in the forums.
Filters:
- Minimum Average Volume of the last 20 days is above 1.000.000 shares (ensure liquidity).
- Minimum price is 1 USD.
Position Sizing:
- Maximum 10 positions, dividing the equity by 10 to get the position size.
Buys:
1. Trade the first day of the week.
2. Last close of the SPY is above the 200 daily SMA band (with a -2% buffer). In case it goes below, we go back to cash.
3. Filter by the 3 day RSI of the stock. If it's below 50 it's a candidate (ensure not overbought).
4. Select the 10 stocks with the highest ROC-percentage increase over the last two hundred (momentum).
Sells:
1. Trade the first day of the week.
2. We rotate when one of the stocks of our portfolio is not in the top 10 ROC.
3. We exit all positions when the SPY is below the 200 daily SMA band (with a -2% buffer).
Notes:
- The algorithm tracks the available cash trying to avoid spending more than we have.
- The rebalance is split in 2 functions with an hour gap. This is just to "ensure" sell orders are filled before we start buying.
- The results are not as good as the backtests shown in the book, I might be missing something. However it does beat the S&P 500.
Other algorithms:
- Mean-Reversion Long - For Bold Contrarians
- Mean-Reversion Short - Money in bad markets