average true range (ATR) needs high, low, close. I cannot use warmup method I believe as my universe changes every month and sometime everyday. I could not find any example of using the history to initialize the indicator that needs more then one value. Basically, I need the equivalent of the folowing sample code for ATR. Thanks a lot in advance.
https://www.quantconnect.com/docs/algorithm-reference/indicators#Indicators-Initializing-Indicatorsdef Initialize(self): self.AddEquity("SPY", Resolution.Hour) # define a 10-period daily RSI indicator with shortcut helper method self.rsi = self.RSI("SPY", 10, MovingAverageType.Simple, Resolution.Daily) # initialize the indicator with the daily history close price history = self.History(["SPY"], 10, Resolution.Daily) for time, row in history.loc["SPY"].iterrows(): self.rsi.Update(time, row["close"])
Shile Wen
Hi Manoj,
Please see this thread on how to initialize indicators with historical data that require more than one value.
Best,
Shile Wen
Manoj Agarwala
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!