I created a custom volatility indicator that's throwing only “Runtime Error:” with no other information when it's registered with Field.Volume. For example…
self.volatility = Volatility(20)
self.RegisterIndicator('AAPL', self.volatility, Resolution.Daily, Field.Volume)
Is this a bug, not possible with custom indicators or am I doing something wrong? Backtest is attached. It wouldn't let me attach the error so I commented out the Field.Volume part and used close for the test. Thanks!
Fred Painchaud
Hi Justin,
It looks like Python custom indicators and Field.Volume do not go well together. Could not find why exactly.
But the attached code is more orthodox.
You can refer to this (eessh self-referencing…): https://www.quantconnect.com/forum/discussion/12691/python-indicator-template/p1
Fred
Justin Busa
Thanks, Fred! I had wanted to take advantage of the automatic warmup but I can do that manually.
Fred Painchaud
Sure.
It still uses self.SetWarmup(self.period) so it still warms up with that many bars with data prior to the beginning of the backtest or prior to now in live trading mode. As with all warm up, OnData gets called with the warm up data to prime the algo/indies. You can use IsReady and/or IsWarmingUp to determine if warming up is finished. IsReady of course is based on whatever tests the method(s) is(are) based on. IsWarmingUp is simply based on the period passed to SetWarmUp. It is true as long as that period is not over.
You can also define OnWarmupFinished() to get notified when warm up is over.
Fred
Justin Busa
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!