[PEL] 复制代码 input:n(20,1,10000,1);
variable:h1:=0,hl1:=0;
variable:l1:=0,lh1:=0;
h1n:=hhv(h,n);
l1n:=llv(l,n);
LEN1:BARSLAST(H=H1N);
LEN2:BARSLAST(L=l1n);
if c<hl1 AND COUNT(c<hl1,LEN1+1)=1 and BARPOS>N then
begin
sell(1,holding,market);
buyshort(holding=0,1,market);
end
if c>lh1 AND COUNT(c>lh1,LEN2+1)=1 and BARPOS>N then
begin
sellshort(1,holding,market);
buy(holding=0,1,market);
end
if h=h1n and BARPOS>=N then
begin
h1:=h1n;
hl1:=l;
end
if L=l1n and BARPOS>=N then
begin
l1:=l1n;
lh1:=H;
end
持仓:holding;
S1:H1;
S2:L1;
这样看下 |