Introduction
I'm embarrassed by the cruft and misplaced items in my code, but unfortunately, I need to share my promising model.
Inception
This is my post meme trade notion. If a stock manages to be a top mover for any period it will likely be priced higher after a multiple of that period. It's stupid momentum.
Execution:
- Hold top 2 three-day gainers 30 days if profitable, else hold until finally profitable
- Capital allocation 10% per trading window
Early results were promising 168%
Comparing this momentum model equity curve to spy, it appeared to have some forward indicating, so…
A Hedge
- I Use it for signaling bull, bear, and dove markets to trade sector and triple leveraged ETFs using leverage
This backtested at:
- $20 million @ 1700%
- $1 million @ 2143%
- $50k @ 1500%
- $10k @ 950%
- $5k @ 620%
The Twist
It stopped working out of the blue. I cannot create these backtest results anymore! Why not? Can you? I was so excited by this model, and frankly didn't want to share it, but I don't know what to do!
Stephan Vanwoezik
Why doesn't the Algo gragh work? Refer to to Overall Stats tab. Here's a screenshot.
Mia Alissi
The provided code has several issues that need to be addressed:
Attribute Errors:
Time
should be accessed usingself.Time
.INVESTED
,IS_SHORT
, andIS_LONG
should be accessed using lowercaseinvested
,is_short
, andis_long
.History Method Overload:
history
method call is incorrect. Ensure that the parameters match one of the overload variants provided in the error message.Type Mismatch:
self.trades_by_price_date_shares_symbol
, which is expected to be a dictionary, needs correction.These errors need to be fixed to ensure the code runs correctly.
Sources: Stock Selection Strategy Based On Fundamental Factors, Momentum Short Term Reversal Strategy, Bybit Crypto Futures Regression Algorithm, Asset Growth Effect, Upcoming Holiday Momentum for Amazon
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.
Mia Alissi
To troubleshoot why the algorithm graph isn't working, let's go through the key steps required for proper charting in QuantConnect:
Chart Initialization: Ensure that you have initialized your charts correctly using the
Chart
object and added them to the algorithm withself.add_chart(chart)
. For example:Series Addition: Confirm that each chart has the necessary series added using the
Series
object andchart.add_series(series)
. For example:Plot Calls: Check your
self.plot(chart_name, series_name, value)
calls to ensure they are correctly referencing existing chart and series names. For example:Reserved Names: Make sure that the chart and series names do not conflict with any reserved names. Avoid using names like "Equity", "Return", "Benchmark", etc., for custom charts.
Data Availability: Ensure that the data being plotted is available and correctly processed before calling the
plot
method. If the data is not available, the plot will not update.Review Logs for Errors: Check the algorithm logs for any errors or warnings related to charting or data processing. This can provide insights into what might be going wrong.
By following these steps, you should be able to identify and fix the issue with the algorithm graph not displaying as expected. If you need further assistance, please provide more details about the specific charting code or any error messages you are encountering.
Sources: Charting - QuantConnect.com, Custom Charting Algorithm, Logging and Plotting - QuantConnect.com, Object Store - 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.
Stephan Vanwoezik
you answer without understanding context. I wasn't saying the algo didn't chart. It did. However, providing the backtest did not pull the chart into the discussion.
Stephan Vanwoezik
This AI troll steals my thunder with meaningless suggestions. The point of my post is - the model performs different over the same sample period. Two weeks ago it performed with astronomical returns, now it is average. makes no sense. Only bots care these days….
Stephan Vanwoezik
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!