根据你说的,大概的代码是这样的
RH:=REF(HHV(H,40),1);
RL:=REF(LLV(L,40),1);
CW:=AVGENTERPRICE*ABS(HOLDING)<=ASSET*0.05;
IF HIGH>=RH THEN BEGIN
BUY(CW,1,LIMIT,RH+10*MINDIFF);
IF OPEN>REF(C,1) THEN BEGIN
BUY(1,5%,LIMIT,C+10*MINDIFF);
END
END
IF (C<=ENTERPRICE*0.98 OR C<=MA(C,55))AND ENTERBARS>=20 THEN BEGIN
SELL(CW,1,MARKET);
END
IF LOW<=RL THEN BEGIN
BUYSHORT(CW,1,LIMIT,RL-10*MINDIFF);
IF OPEN<REF(C,1) THEN BEGIN
BUYSHORT(CW,1,LIMIT,C-10*MINDIFF);
END
END
IF (C>=ENTERPRICE*0.98 OR C>=MA(C,55))AND ENTERBARS>=20 THEN BEGIN
SELLSHORT(CW,1,MARKET);
END