variable:hl=0,kcj=0,nums=0;
entertime:=time>93000 and time<143000;
exittime:=time>=145000;
hi30:=ref(hhv(h,30),1);
lo30:=ref(llv(l,30),1);
if exittime then begin
sell(1,0,limitr,o);
sellshort(1,0,limitr,o);
nums:=0;
end
if holding=0 and nums=0 and ref(c>hi30,1) then begin
buy(1,3,limitr,o);
kcj:=o;
zs:=o-10;
hl:=h;//记录开多后的最高点
nums:=1;
end
if holding=0 and nums=0 and ref(c<lo30,1) then begin
buyshort(1,3,limitr,o);
kcj:=o;
zs:=o+10;
hl:=l;//记录开空后的最低点
nums:=1;
end
if holding>0 and l<zs then sell(1,0,limitr,zs-2*mindiff);
if holding<0 and h>zs then sellshort(1,0,limitr,zs+2*mindiff);
if holding>0 and h>=hl then begin
hl:=h;
if hl>kcj+20 then begin
zs:=hl-20;
sell(holding=3,1,limitr,kcj+20);
sell(holding=2 and hl>kcj+40,1,limitr,kcj+40);
sell(holding=1 and hl>kcj+60,1,limitr,kcj+60);
end
end
if holding<0 and l<=hl then begin
hl:=l;
if hl<kcj-20 then begin
zs:=hl+20;
sellshort(holding=-3,1,limitr,kcj-20);
sellshort(holding=-2 and hl<kcj-40,1,limitr,kcj-40);
sellshort(holding=-1 and hl<kcj-60,1,limitr,kcj-60);
end
end