开仓部分代码如下:
hhv = max(am.high_array[-self.NT - 1:-1]) + atr_array[-2] self.S
llv = min(am.low_array[-self.NT - 1:-1]) - atr_array[-2] self.S
VIX_index = (VIX[-1] / am.close_array[-1]) / sum( VIX[-self.Length2:-1] / am.close_array[-self.Length2:-1]) * 100
if VIX_index > self.M:
if self.pos == 0:
if cond1 and sum(self.MarketPosition) == 0:
self.buy(hhv, self.Lots, stop=True)
self.open_bar = 0 # 开仓历时
self.LowAfterEntry = bar.low_price # 保存开多价格