hi:=ref(hhv(h,20),1);
lo:=ref(llv(l,20),1);
entertime:=time<=144500;
exittime:=time>=145700;
buycond:=c>hi;
sellcond:=c<lo;
if holding>0 and (sellcond or exittime) then sell(1,1,market),orderqueue;
if holding<0 and (buycond or exittime) then sellshort(1,1,market),orderqueue;
if holding=0 and entertime and buycond then buy(1,1,market),orderqueue;
if holding=0 and entertime and sellcond then buyshort(1,1,market),orderqueue;
hi:=ref(hhv(h,20),1);
lo:=ref(llv(l,20),1);
entertime:=time<=144500;
exittime:=time>=145700;
buycond:=c>hi;
sellcond:=c<lo;
if holding>0 and (sellcond or exittime) then sell(1,0,market),orderqueue;
if holding<0 and (buycond or exittime) then sellshort(1,0,market),orderqueue;
if holding=0 and entertime and buycond then buy(1,0,market),orderqueue;
if holding=0 and entertime and sellcond then buyshort(1,0,market),orderqueue;
hi:=ref(hhv(h,20),1);
lo:=ref(llv(l,20),1);
entertime:=time<=144500;
exittime:=time>=145700;
buycond:=c>hi;
sellcond:=c<lo;
if holding>0 and (sellcond or exittime) then sell(1,0,market),orderqueue;
if holding<0 and (buycond or exittime) then sellshort(1,0,market),orderqueue;
if holding=0 and entertime and buycond then buy(1,0,market),orderqueue;
if holding=0 and entertime and sellcond then buyshort(1,0,market),orderqueue;
这个不对的。
我就是这样做的。在个个周期的仓位都不同 如在1分钟能开18 手。10分钟只能开13手。