Hybrid Sentiment-Momentum (HSM) Model, a framework-ready trading strategy that combines technical momentum indicators with sentiment-based filtering to generate high-confidence signals. The model uses RSI (Relative Strength Index) to gauge momentum with a custom threshold above 45 to allow more trading opportunities, MACD to confirm bullish continuation, and ADX to ensure a strong underlying trend is present. For risk management, the model incorporates ATR (Average True Range) to dynamically calibrate trailing stop-loss levels. Designed specifically for Tesla (TSLA), this model capitalizes on its volatility and behavioral patterns, emitting Alpha Streams-compatible insights with a 5-day horizon, 3% magnitude, and 80% confidence. From 2020 to 2024, the HSM model achieved a 112.2% return using QuantConnect’s framework modules with Equal Weighting Portfolio Construction and Immediate Execution.
Mia Alissi
Here are the functional and logical issues found in the main.py:
The technical indicators (RSI, MACD, ADX, ATR) are initialized inside the Update() method, not during algorithm/alpha model construction or in a securities-changed handler. This approach delays indicator warmup and may cause missed signals at startup, especially if Update() is only called after live data is received.
ATR is created, checked for readiness, but not actually used in the trading signal logic. If it is intended only for risk management, this is fine; otherwise, this is incomplete logic.
The AlphaModel never emits a “flat” (neutral/exit) or “down” Insight, so once a position is entered the only way it can be exited is through risk management (e.g., trailing stop). This can lead to unwanted long exposure if only entry signals are generated.
The model only emits a signal once per day (uses lastInsightTime.date()). This prevents duplicate signals per day, but means it will ignore all changes within the same day, including signals to potentially close the position intraday.
Indicator instantiation is done only for the initial TSLA symbol and lacks any OnSecuritiesChanged support for multi-symbol, dynamic universes. As written, the logic does not extend cleanly to multi-security support and will fail to initialize for additional securities if the universe changes.
These are the primary potential issues to consider for robustness and correct behavior in QuantConnect’s algorithm framework.
Sources: Leveraged ETFs With Systematic Risk Management, Short Term Reversal, Key Concepts - QuantConnect.com, Opening Range Breakout for Stocks in Play, Ichimoku Clouds In The Energy Sector
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.
Mouhamad Abushaqra
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!