Hi all,
New to Quantopian! I was reading about gap strategies at thegapguy.com and took my first stab at an algorithm that incorporates some of his core principles along with a few other things I've seen around the forums here. I updated it for the newest Q2 framework. Assumptions are: Robinhood (no short selling, zero-commissions), default VolumeShareSlippage model, starting $100k. Buys scheduled at 1 minute after open, closing sales scheduled 30 minutes before close, targets and stop losses run all day.
Unfortunately, my backtest results show that my approach is far from optimal, with most gap play decisions either wrong or hitting stop losses with few winning bets. This results in a consistent slow downward performance. I have posted it here in hopes that some of you guys can comment on some of the things that might be flawed in my logic or code, or if anyone can make improvements and post back tests here. I think this strategy has some potential but it is tough to say at this point. One of the biggest things that may be a logical flaw is that the arguments from thegapguy.com can be generalized to individual stocks rather than only holding true for the SPY index as a whole.
Thanks in advance for any help with this =)
The algorithm has the following features:
- Top X stocks by market cap and dollar volume ( rank < 4000 and > $100k for now) to ensure liquidity
- RSI >15, < 50 and linear regression (from Trend Follow Algo) to ensure +ve trend since this algo is buy-only
- Avoids mondays (which have lower statistical success for gap trades)
- Avoids opens that are between last 4d high/low (lower statistical success)
- Avoids gaps too large or too small ( < 0.005 = 0.5% or > 0.025 = 2.5% )
- Divides order percentage by number of matching equities with a max single-equity investment of 30%
- Logs some info on gaps/profits/losses
- Does not use z-scoring for normalizing as the algorithm here (market closed gap trade) does, but includes calculation in code