Somehow EMA is slightly off
There's no way I'm not doing something real dumb and this is going to be a simple answer..
I'm trying to use the 100 period EMA of the VIX in my strategy. non trading tickers are always the first data to be added.
("non_trading_tickers", ["VIX"]) ... self.non_trading_ticker_data = self.datas[0:len(self.p.non_trading_tickers)] ... self.vix_index = [i for i, d in enumerate(self.non_trading_ticker_data) if d._name == "VIX"] self.non_trading_ema["VIX"] = bt.ind.ExponentialMovingAverage(self.non_trading_ticker_data[self.vix_index], period=100)
I'm looking at the VIX on trading view on CBOE and through yahoo finance (where I'm getting the data). When I look at May 29th 2019 I see the vix 100 period EMA at 15.9 on both data sources, when I output the 100 period EMA on that date I get
self.log([self.non_trading_ema["VIX"], self.non_trading_ema["VIX"][-1]]) self.log(self.non_trading_ticker_data[self.vix_index].close)
2019-05-29T00:00:00, 15.682198154811706 2019-05-29T00:00:00, 17.899999618530273
15.68 as you can see above. The close is 0.0000001 off but there's no way slight floating point errors would cause a difference of 0.22. I've also spot checked other closes and they are all right (minus floating point error)
I believe I've given enough details, if you want more feel free to ask