一直报错
close = am.close
pre_max = self.pre_max
pre_min = self.pre_min
if(close[-1]>=pre_max[-1] and close[-2] <=pre_max[-2]):
if self.postion > 0:
self.sell(bar.close_price,1)
一直报错
close = am.close
pre_max = self.pre_max
pre_min = self.pre_min
if(close[-1]>=pre_max[-1] and close[-2] <=pre_max[-2]):
if self.postion > 0:
self.sell(bar.close_price,1)
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 286, in run_backtesting
self.callback(data)
File "C:\Users\79119\strategies\pf.py", line 581, in on_bar
if(close[-1]>=pre_max[-1] and close[-2] <=pre_max[-2]):
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
请问有办法debug吗 或者打log
应该是你在拿一列数和一个值相比较。你可以试着打印一下这几个变量或者打印它们的类型看看
xiaohe wrote:
应该是你在拿一列数和一个值相比较。你可以试着打印一下这几个变量或者打印它们的类型看看
怎么打印呢,self.write_log好像没用
用print就行了,可以用run.py打开vnstation
xiaohe wrote:
用print就行了,可以用run.py打开vnstation
多谢
if(close[-1],这里的close,应该只是一个数值。ArrayManager里有close_array,用am.close_array[-1]试试
xiaohe wrote:
用print就行了,可以用run.py打开vnstation
run.py现在是在哪个文件夹里?用run.py打开vnstation的操作步骤是怎样的,请具体指点。