你这种最好是调整下顺序的。
[PEL] 复制代码
HH1:HHV(H,4);
LL1:LLV(L,4);
INPUT:x(3,1,1000,1);
INPUT:y(1,1,1000,1);
SS:=1;
A1:BARSLAST(C>REF(HH1,1));
A2:BARSLAST(C<REF(LL1,1));
VAR1:=A1<A2;
VBR1:=A2<A1;
hh:=hhv(h,enterbars);
ll:=llv(l,enterbars);
if hh-enterprice>=x and c-enterprice<=y and holding>0 then 多回撤:sell(1,holding,marketr);
if enterprice-ll>=x and enterprice-c<=y and holding<0 then 空回撤:sellshort(1,holding,marketr);
IF HOLDING>0 AND VAR1 THEN BEGIN
SELL(1,SS*1,MARKETR);
END
IF HOLDING=0 AND VBR1 THEN BEGIN
BUY(1,SS*1,MARKETR);
END
|