I am using Bollinger Bands, Keltner Channels to do some checks. I consistently notice that all the values of these indicators are completely wrong when I compare them to real data on my ThinkorSwim platform.
Is this a test environment problem? I don't have confidence to go live with this if the data on which I am basing my trading rules is incorrect.
Here is how I am initializing it: Note that even EMAs are wrong too, but I am trying to get BBs and KCs to work first. Relevant code given below:
I have added long entries and can confirm that values are completely off. Here is one example that you can check yourself with SPY data for 1-3-2022 date. Note that all BB and KC values are wrong:
[2022-01-03 Monday] SPY Squeeze Check: BB Upper: 478, BB Lower: 474, KC Upper: 480, KC Lower: 472, Squeeze: True
//Here I am initializing SPY for example.
var equity = AddEquity(ticker, Resolution.Daily);
equity.SetDataNormalizationMode(DataNormalizationMode.Raw);
//Setting up indicators for SPY. All this is happening in Intialize() function
_ema8[ticker] = EMA(ticker, 8, Resolution.Daily);
_ema21[ticker] = EMA(ticker, 21, Resolution.Daily);
_ema34[ticker] = EMA(ticker, 34, Resolution.Daily);
_bollingerBands[ticker] = BB(ticker, 20, 2, MovingAverageType.Simple, Resolution.Daily);
_keltnerChannels[ticker] = KCH(ticker, 20, 1.5m, MovingAverageType.Simple, Resolution.Daily);
Mia Alissi
It's important to note that different platforms might use different methods to calculate indicators, which can lead to slight differences in the values. For instance, some platforms use all of the historical data to warm up their indicators while LEAN indicators have a fixed number of bars they need to warm up. As a result, indicators with long memory like the Exponential Moving Average can have slightly different values across platforms. This is mentioned in the QuantConnect documentation.
In your case, you are using Bollinger Bands and Keltner Channels. Here is how you can initialize these indicators in QuantConnect:
For Bollinger Bands:
For Keltner Channels:
These are initialized correctly as per the QuantConnect documentation.
If you still find discrepancies, it might be due to the data source or the calculation method used by the other platform. It's recommended to understand the calculation method used by the other platform and compare it with the method used by QuantConnect. If the methods are different, that could explain the discrepancy.
If you believe there's an issue with the data or the calculation of the indicators in QuantConnect, you can raise an issue on the QuantConnect's Lean GitHub repository.
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.
Dee Znut
I found out that if I drop the resolution of the equity to Hourly, the indicators which need daily data start working perfectly. Mia needs to calm down, she doesn't give any good answers ever.
Dee Znut
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!