Hey guys, I was looking through one of the recent forum posts on using history to update indicator bars in the universes. I ran the backtest and noticed that, while it ran, the log actually didn't output the correct data to use. All of the ADX values were 50 and all of the ATR values were 0. I'm not sure how to fix this to make it useable.
Brad Hearne
This is the discussion that the backtest is from:
https://www.quantconnect.com/forum/discussion/5870/updating-adx-in-universe-and-label-not-in-index-issues
Daniel Chen
Hi Brad,
Thank you for your question. It is a really good observation. In fact, a missing argument in TradeBar caused this issue. It should be bar = TradeBar(tuple.Index, symbol, tuple.open, tuple.high, tuple.low, tuple.close, tuple.volume) rather than bar = TradeBar(tuple.Index, tuple.open, tuple.high, tuple.low, tuple.close, tuple.volume) in line 70. We should add the symbol of the equity when creating TradeBar. In this way, the ADX and ATR will get updated correctly and they are no longer always 0 and 50. Besides, I log the values of other indicators too (SMAv, SMA, and RSI). All of them get updated correctly and their values are reasonable.
Now, feel free to combine Universe Selection and different Indicators. We hope you can create some amazing algorithms based on this example. Good luck!
Brad Hearne
Awesome! Thank you for the help!!!
Brad Hearne
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!