Hello,
Can someone help me understand why this algorithm didn't trade SBET on 5/27 in this backtest? The log says "2025-05-27 – SBET NOT included: not in top-50 gap list," but I have screenshots here showing that it had the highest gap of any stock on 5/27.
And can someone help me understand why this algorithm didn't trade KNW on 6/6 in this backtest? The log says "2025-06-06 – KNW NOT included: failed price/volume screen," but I have screenshots here showing that it did meet the price screen and the volume screen on 6/6. Or is this algorithm not looking at premarket volume? I thought the course filter in line 42 included any stock with premarket volume of 1,000,000 greater. Is that not what the algorithm is doing though? I want that line 42 filter to include any stock that has seen 1,000,000 shares change hands between midnight and 9:30am EST (market open) on that day. How can I edit that filter to make it work as intended for premarket volume?
Thanks!
Mia Alissi
Root causes of the two “missing” trades
SBET (2025-05-27)
c.volume > 1_000_000, butc.volumeis the previous day's regular session volume, not today's premarket volume._log_symbol()is accurate when it logs “SBET NOT included: failed price/volume screen”—this means SBET never enters the candidate universe that day, despite a large gap premarket.KNW (2025-06-06)
_build_gap_universe()runs at 9:30:10am, before the first 9:30–9:31 bar (today's open) exists in the minute data for most symbols.sec.openat that moment still points to the previous day's open—not the intended 9:30am open price.(yesterday_open − yesterday_close) / yesterday_close, often slightly negative.Why your volume screen isn't working as intended
The expression
c.volume > 1_000,000usesCoarseFundamental.volume, which represents the last full regular session volume—not today's premarket or combined session volume.This means that premarket block trades or spikes are ignored, and the filter isn’t actually screening for overnight liquidity.
How to properly filter for premarket volume
>= 1,000,000from midnight to 9:30amMove the gap universe build schedule: Run it at 9:31am (not 9:30:10) to ensure minute bar data for 9:30 is available.
Loosen the coarse filter: In
_coarse_select, keep only the price-check (not volume). This keeps the candidate list feasible but doesn't drop stocks for weak prior-day volume.Add the true premarket volume filter in the universe build: For each symbol in your candidate set:
Fix the gap calculation:
With these changes, your actual premarket volume filter will work as you intend—and SBET (5/27) and KNW (6/6) will both pass the premarket volume test, rank by actual gap, and be eligible for trading based on true opening conditions.
Summary:
Sources: Opening Range Breakout for Stocks in Play, Momentum And State Of Market Filters, Piotroski F-Score Investing
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
Thanks! Could you please provide the newly coded algorithm with your 4 suggested changes?
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!