Hello,
Mia the AI assistant shared this debugging code with me, but then a new window opened and my conversation with Mia was gone. Is there a way to see a history of my conversation with Mia so I can go back and look? I'm not sure what she said for how to use this. I'm trying to figure out why my algorithm didn't trade any stocks on 5/27. I know the stock SBET met the criteria I have, but the algorithm never traded it. Can someone please help me with debugging or my conversation history with Mia or otherwise? Thanks!
Mia Alissi
Here are the implementation/logic findings that might prevent your algorithm from trading SBET on 2025-05-27 even when you believe it should:
1. Single-Day Backtest, Insufficient History
history
will be empty or have only one entry.How to fix:
Extend your backtest start date to at least one day before (2025-05-26 or earlier), so QC can load prior price data for all your gap checks.
2. Universe Selection & Fundamental Data
How to fix:
To ensure SBET is tradable, you might consider using
self.add_equity("SBET")
directly, or check the coarse universe selection debug output for presence of SBET.3. Data Resolution/Tick Frequency
self.time.second
and expects bars to show up each second, but if you run in Daily or Hourly resolution, bars might not be available as frequently as the loop expects, causing.bars
to be empty indata
.How to fix:
Consider using
Resolution.Minute
or higher-frequency data, or rework your logic to operate only when a daily bar appears (e.g., by checking timestamps or usingOnData
with daily bars).4. Order Sizing/Zero Quantities
qty = 0
, you will skip buying.How to fix:
Check account cash, and debug if SBET’s price is too high for your portion of cash. You may want a minimum order quantity safeguard or check if 0.01 is too restrictive.
5. Data Availability at Market Open
6. End-of-Day Liquidation
Summary of Most Likely Blocker
The most likely reason for no trades is (1): You do not have at least two days in your backtest, so the gap-up logic can never execute.
Extend your
set_start_date()
to at least one day before your intended trade day.Suggested change:
Check your debug output for "Not enough history for previous close, skipping." -- If you see this for SBET, it confirms the culprit.
If you still have issues after extending your backtest window, check your debug output for SBET's presence in the universe and bar data availability, or post that output for further review.
Sources: Momentum And State Of Market Filters, Opening Range Breakout for Stocks in Play, Momentum Effect In Commodities Futures, Head & Shoulders TA Pattern Detection, Futures - 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.
Digitall
Oh is this log limit the reason that no trades were made?
Or is this log limit just preventing me from seeing what happened with SBET?
Digitall
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!