Hi. I'm working on Warming Up Indicators for securities in my Opening Watchlist.
I was able to warmup the EMA, I did this the same way it was presented in BootCamp (working code below).
@ OnData
for i in self.opening_watchlist:
history = self.History(i, 270, Resolution.Daily)
self.indicators[i] = DailyWarmup(history)
@ DailyWarmup:
def __init__(self, history):
self.ema = ExponentialMovingAverage(200)
for bar in history.itertuples():
self.ema.Update(bar.Index[1], bar.close)
However, when I tried to update the ATR in a similar way, I got errors (faulty code below).
@ DailyWarmup:
def __init__(self, history):
self.ema = ExponentialMovingAverage(200)
self.atr = AverageTrueRange(14)
for bar in history.itertuples():
self.ema.Update(bar.Index[1], bar.close)
self.atr.Update(bar.Index[1]) # I tried variations of this, including bar.high and bar.low
Here is the Error the code above threw:
Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'pandas._libs.tslibs.timestamps.Timestamp'>) method. Please checkout the API documentation.
at __init__
self.atr.Update(bar.Index[1])
File "main.py" in main.py:line 277
What do I need to do to Warmup the ATR here? I will be doing VWAP next.
Thank you,
Cesare
Varad Kabade
Hi Cesare Augustus,
ATR is a particular type of indicator which takes input as a trade bar instance to update it. Unlike other indicators which require decimal input. Refer to the following code snippet for reference.
Best,
Varad Kabade
Varad Kabade
Cesare Augustus
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!