如何能第一时间发出平仓委托?即开仓单一成交后,就同时发出固定价止赢的平仓委托单。我现在下面二段程序,但是哪段都只会开仓,没有平仓动作,请求高见!
//震荡区间
GW:REF(HHV(HIGH,50),1);
DW:REF(LLV(LOW,50),1);
//在震荡区间低位,平空开多
IF DYNAINFO(7)>0 AND Tholding = 0 THEN Tbuy(1, 1,LMT, DW);
if DYNAINFO(7)>0 and Tholding < 0 then begin
Tsellshort(1, 0, LMT,tenterprice-2);
Tbuy(1, 1,LMT, DW);
end
//在震荡区间高位,平多开空
if DYNAINFO(7)>0 and Tholding > 0 then begin
Tsell(1, 0,LMT, tenterprice+2,0,0);
Tbuyshort(1, 1, LMT,GW,0,0);
end
IF DYNAINFO(7)>0 AND Tholding = 0 THEN Tbuyshort(1, 1, LMT,GW,0,0);