Hello,
I'm wondering if it's possible to create a new watchlist every day to be scanned every second while the market is open? Is it possible to use premarket volume to filter for stocks? Is it possible to code the following strategy?
From a morning scan at 9:31.10 ET, I want the algorithm to create a watchlist of the 25 US stocks that have the biggest gap up from yesterday's close price to their current price today. I only want a stock added to the watchlist if its opening price today is $0.50 or higher. I only want a stock added to the watchlist if its volume (including premarket volume) today from 12:01am ET to 9:31am ET is more than 1,000,000. I only want the debug/logs to show me why SBET was or wasn't included on the watchlist on 5/27. I want it to be very specific to show if it wasn't included because of volume or price or something else.
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 QuantConnect Python algorithm that implements your requested strategy:
This code creates a new watchlist every day after 9:31:10 AM ET, filters for the top 25 gap-up US stocks by open price and pre-market volume, scans those every second, buys if the day's high exceeds 30% over open, and auto-sells at 35% gain/loss or at close. It logs exactly why SBET was (or wasn't) included on 5/27. After close, everything is reset for the next day.
Sources: Overnight Anomaly, Head & Shoulders TA Pattern Detection, Momentum And State Of Market Filters, Momentum Effect In Commodities Futures, WallStreetBets - QuantConnect.com
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!