为什么这里会出现卖出开仓的单子

if (sl!=0 and SpeLimit!=0 and dir!=0 and lev!=0){ if (dir==1 and pos.longCurrentVolume==0 and close>SpeLimit and close[1]<=SpeLimit){ CurPos=pos.longCurrentVolume; TRes=A_SendOrder(Enum_Buy,Enum_Entry,positions,Q_AskPrice); Alert("Buy - "+IIFString(TRes, "True", "False")+" - "+Text(CurPos)+" - "+Text(pos.longCurrentVolume)); } else if (pos.longCurrentVolume>0 and close<SpeLimit and close[1]>=SpeLimit){ CurPos=pos.longCurrentVolume; TRes=A_SendOrder(Enum_Sell,Enum_Exit,CurPos,Q_BidPrice); Alert("Sell - "+IIFString(TRes, "True", "False")+" - "+Text(CurPos)+" - "+Text(pos.longCurrentVolume)); } else if (dir==-1 and pos.shortCurrentVolume==0 and close<SpeLimit and close[1]>=SpeLimit){ CurPos=pos.shortCurrentVolume; TRes=A_SendOrder(Enum_Sell,Enum_Entry,positions,Q_BidPrice); Alert("SellShort - "+IIFString(TRes, "True", "False")+" - "+Text(CurPos)+" - "+Text(pos.shortCurrentVolume)); } else if(pos.shortCurrentVolume>0 and close>SpeLimit and close[1]<=SpeLimit){ CurPos=pos.shortCurrentVolume; TRes=A_SendOrder(Enum_Buy,Enum_Exit,Curpos,Q_AskPrice); Alert("BuyToCover - "+IIFString(TRes, "True", "False")+" - "+Text(CurPos)+" - "+Text(pos.shortCurrentVolume)); } } 从日志来看,执行了Sell这一组的平多仓的操作,看起来是仓没有平完的时候又执行了Sell部分的代码,但为什么会出现开空仓?结果是多了很多空头头寸。

1.代码看上去贴了,但仍然是局部代码2.日志上可以圈一下 哪个是有问题的单子3.如果正好出现相反的内容,检查是否开了开平互转