if 平多条件 then begin
if 持仓>0 then 平多语句;
if 持仓<=0 then begin
平空语句;
开多语句;
end
end
if TISREMAIN(2 )<>0 and 平多条件 then tbuyshort........;
或者
if TISREMAIN(2 )<>0 and 平多条件 then TCANCEL( 平多条件, 2);
if TISREMAIN(2 )<>0 and 平多条件 and tbuyholding(0)=0 then tbuyshort........;
或者
if TISREMAIN(2 )<>0 and 平多条件 and tbuyholding(0)=0 then TCANCEL( 平多条件, 2);