I've extraced my issue into a simple backtest project, I want to use Fast/Slow EMA indicators for a crossover indicator. However, the fast and slow indicator values seems to converge which seems very odd.
I was expecting something more like TradingView for EMA on VIX over the same period.
I'm probably doing something silly as still learning the platform.
Appreciate any advice.
Mia Alissi
From the code you've provided, it seems like you're trying to plot the Fast and Slow EMA of the VIX futures. However, there might be an issue with the way you're initializing your EMA indicators.
In your
Initialize
method, you're creating the EMA indicators with this line:The third argument you're passing into the
EMA
method (0.5) is actually the smoothing factor for the EMA calculation. This value is typically calculated as2 / (period + 1)
. For an 8-period EMA, the smoothing factor should be2 / (8 + 1) = 0.2222
, and for a 21-period EMA, it should be2 / (21 + 1) = 0.0952
.However, the EMA helper method in QuantConnect only takes two arguments: the symbol and the period. The smoothing factor is calculated internally. So, you should initialize your EMA indicators like this:
Try making this change and see if it resolves the issue. If the problem persists, it might be helpful to check the data you're receiving for the VIX futures and make sure it's what you expect.
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.
Martin
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!