调用MACD当前柱状大于上一个柱状做多,MACD当前柱状小于上一个柱状做空,总是报错。
Traceback (most recent call last):
File "d:\vn\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 288, in run_backtesting
self.callback(data)
File "d:\vn\lib\site-packages\vnpy\app\cta_strategy\strategies\double1_ma_strategy.py", line 72, in on_bar
self.fast_ma0 = hist[-1]
TypeError: 'function' object is not subscriptable
下面是调用代码
self.macd, self.signal, self.hist = self.am.macd(self.fast_period, self.slow_period, self.signal_period)
self.fast_ma0 = hist[-1]
self.fast_ma1 = hist[-2]
cross_over = self.fast_ma0 > self.fast_ma1
cross_below = self.fast_ma0 < self.fast_ma1