Hi everyone!
I have 3 questions based on the attached backtest of a simple algorithm. I hope someone can answer me š
- Are you able to āunregister an indicatorā in OnSecuritiesChanged when a stock is removed from the universe? I read somewhere that you cannot, so what happens when a stock that has registered an indicator in the past gets removed and then gets added back to the algorithm again? Wouldn't it have 2 of the same indicator registered to it?
- Assuming that you can āunregisterā an indicator, in OnSecuritiesChanged, I want to remove all data related to the stock if it is removed from the universe (and āunregisterā the indicator and remove the consolidator from the subscription manager). Have I done it correctly in the example?
- This is just out of curiosity, I've set AutomaticIndicatorWarmup to True, how does it work in the backend for the algorithm to warmup my indicators with consolidated data?
Varad Kabade
Hi Li Cheng,
1 & 2. At the moment it is impossible to de-register an Indicator created by the helper method (self.EMA(),self,SMA()). For indicators created by constructors, we can remove the subscription to the consolidator using SubscriptionManager. We reviewed the attached backtest it is correct but we recommend removing the following line as it is redundant:
AutomaticIndicatorWarmup works similar to making a history request and updating the indicator manually
Best,
Varad Kabade
Li Cheng
Hi Varad, thanks for answering my questions! I'll keep in mind that there is no need for this line to be in the code.
Really appreciate the work you guys are doing in keeping the QuantConnect Community alive and learning!
Li Cheng
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!