I have same indicator for multiple symbols.
I need to record indicator data for each symbol in rolling windows.
How can I get symbol variable here?
def stochastic_updated(self, sender, updated):
self.windows['stochastic'][symbol].Add(updated)
Xin Wei
Hi Konstantin,
You can achieve this by creating multiple rolling windows of the same indicators in Initialize method. There you could easily create a list of security symbols and use a loop to access them. Please see my attached backtest for implementation details, and feel free to let me know if you have further questions.
Konstantin P.
For me it seems like you overwrite same window for every symbol.
How do you access "AAPL" window in your example?
Xin Wei
Hi Konstantin,
Sorry that I misunderstood your original question. Here is a community post that you may find helpful. I modified the code Jing Wu provided in this post and am attaching the backtest below. You can see the rolling windows for all symbols printed out in the console. Please check it out and let me know if you have further questions.
Konstantin P.
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!