代码中定义了:
variables = [
"fast_ma0",
"fast_ma1",
"slow_ma0",
"slow_ma1",
]
提示出错是这一段:
判断均线交叉
cross_over = (self.fast_ma0 >= self.slow_ma0 and
self.fast_ma1 < self.slow_ma1)
cross_below = (self.fast_ma0 <= self.slow_ma0 and
self,fast_ma1 > self.slow_ma1)
提示如下:
16:44:11 Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 288, in run_backtesting
self.callback(data)
File "C:\Users\linxizhiri\strategies\demo_strategy.py", line 87, in on_bar
self,fast_ma1 > self.slow_ma1)
NameError: name 'fast_ma1' is not defined
q
16:44:11 开始计算逐日盯市盈亏
16:44:11 成交记录为空,无法计算
16:44:11 开始计算策略统计指标
16:44:11 策略统计指标计算完成
NameError: name 'fast_ma1' is not defined
q
16:44:11 开始计算逐日盯市盈亏
16:44:11 成交记录为空,无法计算
16:44:11 开始计算策略统计指标
16:44:11 策略统计指标计算完成