Hi, I've been digging into creating very hybrid models consisting of multiple alpha models, each working on different timeframes and also each having different symbols (Idea is to backtest and launch a whole portfolio in one go).
I got a hang of some things already (see the code attached) but it doesn't seem to be trading futures.Is there a way to have both index for calculations and rolling futures for trading in the framework environment?
Thank you
P.S. some code is in #, like the insights (I have been debugging). When they are un-#-ed, they still don't send any orders. It's probably because of order handling
Mia Alissi
Based on the provided code, it seems that the
alpha_1_day
andalpha_1_week
classes are not generating any insights, which could be the reason why no trades are being made. In theUpdate
method, an emptyinsights
list is created and returned, but no insights are added to this list.In the
Update
method, you have a condition that checks if the close price of the bar is greater than a certain level. If it is, you print a debug message but no insight is generated. If you want to generate a buy or sell signal based on this condition, you should create an insight and add it to theinsights
list. Here is an example of how you can do this:Also, in the
OnSecuritiesChanged
method, you are scheduling theSetLevel
andLiquidatePositions
methods to be called at certain times. However, these methods do not seem to be implemented in the provided code. You should ensure that these methods are implemented and are performing the desired actions.Lastly, you are using the
SubscriptionManager.AddConsolidator
method to add a consolidator for each security. However, it seems that you are not removing the consolidator when the security is removed. You should ensure to remove the consolidator when the security is no longer in the universe. You can do this in theOnSecuritiesChanged
method when handlingchanges.RemovedSecurities
.Please note that these are just suggestions based on the provided code and the actual implementation may vary based on your specific requirements.
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.
Vytautas Zukauskas
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!