VARIABLE:mark=0; VARIABLE:mark2=0; atrx:=2; 手数:=1; hh:hhv(ref(h,1),30); ll:llv(ref(l,1),20); aa:BARSLAST(c>hh and holding=0)+1; bb:BARSLAST(c<ll and holding=0)+1; TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)); ATR:=MA(TR1,14); zhis1:=ref(low,aa)>low and holding>0; zhis2:=ref(h,aa)<h and holding<0; if ref(low,aa)>low and holding>0 then sell(1,holding,LIMIT,c); if ref(h,aa)<h and holding<0 then SELLSHORT(1,holding,LIMIT,c); tq:=3; abb:=(time0-TIMETOT0(DYNAINFO(207))<=tq) or not(ISLASTBAR); zhiy1:(AVGENTERPRICE-c)>ATR*atrx and HOLDING<0; zhiy2:(C-AVGENTERPRICE)>ATR*atrx and HOLDING>0; 平空:SELLSHORT((AVGENTERPRICE-c)>ATR*atrx and HOLDING<0,手数,MARKET); 平多:SELL((C-AVGENTERPRICE)>ATR*atrx and HOLDING>0,手数,MARKET); if ref(low,aa)>low and holding>0 then begin mark:=mark+1; end if c>=hh and holding=0 and mark<2 then begin 开多:BUY(c>=hh and holding=0,手数,MARKET); end if time>=closetime(0) then mark:=0; if ref(h,aa)<h and holding<0 then begin mark2:=mark2+1; end if c<=ll and holding=0 and mark2<2 then begin 开空:BUYSHORT(c<=ll and holding=0,手数,MARKET); end if time>=closetime(0) then mark2:=0; |