Hello,
Is it possible to code the following strategy?
I want an algorithm that creates a watchlist every morning at market open with the top 40 “gappers.” Those 40 “gappers” are the stocks that have the highest percentage gap up or jump up from their lower closing price yesterday to their higher opening price today.
For the coarse selection every morning, I want the algorithm to only look at stocks with a market cap below $5 billion. And for the coarse selection every morning, I want the algorithm to only look at stocks with a share price between $1 and $50 at market open.
For example, on 6/5 the stock SBET closed at a price of $0.51 per share, VERO closed at $2.39, and WBUY closed at $4.60. On the next trading day of 6/6, SBET opened at $1.03, VERO opened at $3.89, and WBUY opened at $7.27. Those are gaps of 102%, 63%, and 58% with market caps below $5 billion and opening share prices between $1 and $50. The watchlist created on the morning of 6/6 at market open should include these very large “gappers.”
After the watchlist is created, I want my algorithm to scan that watchlist every second until market close. I want the algorithm to buy any stock on my watchlist when that stock hits 30% above its open price. I want my algorithm to sell a position when it hits a 35% profit or a 35% loss. As soon as my algorithm sells a stock, I want that stock taken off the watchlist so that the algorithm does not trade that stock again during that day. If any positions are still open a few seconds before market close, I want them all closed. I want the watchlist cleared after market close.
Thanks!
Mia Alissi
Here is a complete QuantConnect algorithm implementing 'Digitall's gapper strategy exactly as described:
This code will:
Let me know if you have any questions or want any part changed!
Sources: Head & Shoulders TA Pattern Detection, Gap Side By Side White - QuantConnect.com, Overnight Anomaly, Opening Range Breakout for Stocks in Play, Price Gap Mean Reversion Alpha
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Retrospective Green Ocelot
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!