if tholding>0 and tenterbars>1 and L<=zs then
BEGIN
MyTPrice :=IF(OPEN<zs,OPEN,zs);
tsell(1,ss,Lmt,MyTPrice-MINDIFF);
END
if tholding<0 and tenterbars>1 and H>=zs THEN
BEGIN
MyTPrice :=IF(OPEN>zs,OPEN,zs);
tsellshort(1,ss,lmt,MyTPrice+MINDIFF);
END
//开多单
IF H>=UpperBand and BLIQCON and THOLDING=0 THEN
BEGIN
MyPrice :=IF(OPEN>UpperBand,OPEN,UpperBand);
tbuy(1,ss,lmt,MyPrice+MINDIFF);
zs:=Mdg;
maxhl:=h;
END
//开空单
IF L<=LowerBand and SOPCON and THOLDING=0 THEN
BEGIN
MyPrice :=IF(OPEN<LowerBand,OPEN,LowerBand);
tbuyshort(1,ss,lmt,MyPrice-MINDIFF);
zs:=Mdd;
maxhl:=l;
END
if Tholding<0 and l<maxhl then begin //重新定位离场实现浮动止损止盈
zs:=Mdd;
end
if Tholding>0 and h>maxhl then begin
zs:=Mdg;
end