runmode:0;
variable:cw=0;
input:lots(1,1,100,1);
...
if cw=0 and Short then begin//Short是开空条件
buyshort(1,lots,limitr,o-JumpOffset);//用开盘价成交
cw:=cw-lots;
end
if cw<0 and long then begin//cw是本策略的仓位参数,long是开多条件
sellshort(1,lots,limitr,o+JumpOffset);//lots是下单手数
buy(1,lots,limitr,o+JumpOffset);//用开盘价成交
cw:=cw+2*lots;
end
请问:1、原帐户里有1手空单、策略已是开1手空单状态,此时才加载帐户、其信号和持仓是同步的(但策略实际并没执行之前的buyshort语句),请问这时cw是0?还是-1?
2、先用sellshort平空单、再用buy开多单,几乎是同步发指令,请问会不会导致开多单资金不足呢?(假设帐户只够1手的保证金的话)
谢谢
1,-1
2,可能会有影响,可以在开平仓语句后面加上orderqueue函数
请问Just是这样改吗?
if cw<0 and long then begin//cw是本策略的仓位参数,long是开多条件
sellshort(1,lots,limitr,o+JumpOffset),orderqueue;//lots是下单手数
buy(1,lots,limitr,o+JumpOffset);//用开盘价成交
cw:=cw+2*lots;
end
谢谢
每个下单语句都要加上ordrequeue
如果可以保证第一时间就会成交,可以用orderqueue
否则具体方法见 阿火秘笈 日内满仓下单的方法