以下为范例,供参考:
VARIABLE:M=0,N=0;
IF DK>=18 AND M=0 THEN BEGIN
BUY(HOLDING=0,1,MARKET); //开多
M:=M+1;
END
IF DK<10 AND N=0 THEN BEGIN
BUYSHORT(HOLDING=0,1,MARKET); //开空
N:=N+1;
END
IF ABS(C-ENTERPRICE)>=30*MINDIFF THEN BEGIN //盈利或亏损超30个点,平仓。
SELL(HOLDING>0,HOLDING,MARKET);
SELLSHORT(HOLDING<0,HOLDING,MARKET);
END
IF (ISLASTBAR AND T0TOTIME(TIMETOT0(CLOSETIME(0))-300)<=DYNAINFO(207)) OR (TIME=CLOSETIME(0) AND NOT(ISLASTBAR)) THEN BEGIN
SELL(HOLDING>0,HOLDING,MARKET); //收盘前5分钟清仓
SELLSHORT(HOLDING<0,HOLDING,MARKET);
M:=0;
N:=0;
END