代码:
if 开空条件 and HOLDING>0 then sell(1,手数,MARKET);
if 开多条件 and HOLDING=0 then begin
开多:BUY(1,手数,MARKET);
hl:=h;//记录开仓后的最高点
zs:=enterprice*(1-stop0*0.01);//初始止损
s:=0;
end
if 开多条件 and HOLDING<0 then sellshort(1,手数,MARKET);
if 开空条件 and HOLDING=0 then begin
开空:BUYSHORT(1,手数,MARKET);
hl:=l;//记录开仓后的最高点
zs:=enterprice*(1+stop0*0.01);//初始止损
b:=0;
end;