I have trouble using DataNormalizationMode.Adjusted.
I want to calculate indicators for my backtest. To that end, I want to use adjusted stock data. Here is the code from Initialize
equity_1D = self.AddEquity("AAPL", Resolution.Daily)
equity_1D.SetDataNormalizationMode(DataNormalizationMode.Adjusted)
self.symbol_1D = equity_1D.Symbol
For Apple on 2018-01-02, I get the following OHLC data: 170.16 172.3 169.26 172.26
When I cross check this with TradingView (which also has adjusted data - to my knowledge), Apple trades at 40ish USD.
Any points how to fix this?
Mia Alissi
The discrepancy you're seeing is due to the fact that QuantConnect's data is adjusted for splits and dividends by default, which is why you're seeing a higher price for AAPL. This is done to produce a smooth price curve for backtesting purposes. The 'DataNormalizationMode.Adjusted' setting you're using is actually the default setting for equities in QuantConnect [source].
TradingView might be showing the raw, unadjusted price, which is why it's significantly lower. If you want to see the raw, unadjusted prices in QuantConnect, you can set the DataNormalizationMode to 'Raw' like this:
However, please note that using raw prices can lead to issues with indicators and risk management, especially around corporate events like splits and dividends [source].
If you want to use adjusted data for your indicators and raw data for your backtest, you might need to handle this manually in your algorithm. Unfortunately, there's no built-in way to do this in QuantConnect at the moment [source].
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.
Kryz
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!