我的交易公式如下,用的是3分钟周期,高频扫描:
//指令 1
if OT and B_SL and Tholding<0 then begin //止损
TSellshort(1,0,lmt,BPR);
end
//指令 2
if OT and BO and Tsubmit(0)=0 and Tisremain(0)=0 and Tholding=0 then begin //止损后的开多
TBuy(1,OAT,lmt,BPR);
end
//指令 3
if OT and BC and BO and Tsubmit(0)=0 and Tisremain(0)=0 and THolding<0 then begin //反手
TSellshort(1,0,mkt),orderqueue;
TBuy(1,OAT,mkt),orderqueue;
end
上面试图用Tsubmit和Tisremain阻止重复开仓。
运行的实际结果是不起作用,还是会出现重复开仓,即反手后(指令3),指令2又被执行。Tholding2也试过了。
今天还出现了另一个问题,在debugfile输出的记录中,Tsubmit(0)在没有未成交委托的情况下,返回非0值。而Tisremain始终为0,即使在反手的平和开中间(平掉后,开仓尚未执行完)。
请帮忙看看什么问题,是否我的用法有问题。
另外,就像我在群里提过的,建议对每条指令和各种参数,在各种可能的状态下,都做一下实盘测试