Hi,
I'm calculating indicator points across multiple different timeframes in my SymbolData class:
# indicators
self.indicators = dict()
daily = ['ao_1d', 'dmi_1d', 'rsi_1d']
self.indicators['ao_1d'] = AwesomeOscillator(5, 34)
self.indicators['dmi_1d'] = AverageDirectionalIndex(14)
self.indicators['rsi_1d'] = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
# self.indicators['lwst'] = LiquidityWeightedSuperTrend()
hours_4 = ['dmi_4h', 'macd_4h', 'aroon_4h']
self.indicators['dmi_4h'] = AverageDirectionalIndex(14)
self.indicators['macd_4h'] = MovingAverageConvergenceDivergence(12, 26, 9)
self.indicators['aroon_4h'] = AroonOscillator(14, 14)
hour = ['vwma_l', 'vwma_h', 'ao_1h', 'rsi_1h', 'aroon_1h']
self.indicators['vwma_l'] = VolumeWeightedMovingAverage(6)
self.indicators['vwma_h'] = VolumeWeightedMovingAverage(24)
self.indicators['ao_1h'] = AwesomeOscillator(5, 34)
self.indicators['rsi_1h'] = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
self.indicators['aroon_1h'] = AroonOscillator(14, 14)
for name, indicator in self.indicators.items():
if name in daily:
algorithm.register_indicator(symbol, indicator, TradeBarConsolidator(timedelta(days=1)))
elif name in hours_4:
algorithm.register_indicator(symbol, indicator, TradeBarConsolidator(timedelta(hours=4)))
elif name in hour:
algorithm.register_indicator(symbol, indicator, TradeBarConsolidator(timedelta(hours=1)))
However, when I compare the values of these compared to TradingView charts, the difference is immense.
why is that?
Mia Alissi
To address the discrepancies between your indicator values and those on TradingView, consider the following points based on the provided documentation and API references:
Data Source and Resolution: Ensure that the data source and resolution in your algorithm match those used by TradingView. The
TradeBarConsolidator
should be set up with the correct time periods. For example, if you're using daily data, ensure that theTradeBarConsolidator
is set totimedelta(days=1)
.Timezone Settings: The data time zone in QuantConnect might differ from TradingView. QuantConnect timestamps data to the end of the period, while other platforms might use the start. Ensure that your algorithm's timezone settings align with TradingView.
Indicator Parameters: Double-check that the parameters for each indicator (e.g., periods for moving averages) are identical to those used in TradingView.
Data Alignment: Verify that the data fed into the indicators is aligned correctly, especially at the start and end of each period. Misalignment can cause significant differences.
Warm-Up Period: Ensure that the indicators have sufficient historical data to warm up before being used in calculations. Insufficient data can lead to inaccurate initial values.
Consolidator Usage: The
TradeBarConsolidator
should be used correctly. It aggregates smaller bars into larger ones based on the specified period. Ensure that the period set in the consolidator matches the intended timeframe.By addressing these points, you should be able to reduce the discrepancies between your indicator values and those on TradingView.
Sources: Key Concepts - QuantConnect.com, Key Concepts - QuantConnect.com, Key Concepts - QuantConnect.com, Key Concepts - QuantConnect.com, Consolidate Hour Bars Into Daily Bars Regression Algorithm
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.
Tamer
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!