[PEL] 复制代码 variable:len1:=0,len2:=0;
ema30:ema(c,30),colorwhite;
ktxs:=ema30>ref(ema30,1) and ref(ema30,1)>ref(ema30,2) and c>ema30;
ktxx:=ema30<ref(ema30,1) and ref(ema30,1)<ref(ema30,2) and c<ema30;
if ktxs then len1:=len1+1;
if not(ktxs) then len1:=0;
if ktxx then len2:=len2+1;
if not(ktxx) then len2:=0;
if ktxs then red:ema30,colorred;
if ktxx then green:ema30,colorgreen;
ma30:ma(c,30),coloryellow;//普通均线
jc:=cross(c,ma30);
sc:=cross(ma30,c);
if count(jc,len1)<=2 and len1>0 and isup and jc then buy(holding=0,1,market);
if count(sc,len2)<=2 and len2>0 and isdown and sc then buyshort(holding=0,1,market);
hc:=hhv(h,len1),nodraw;//多趋势最大的C
lc:=llv(l,len2),nodraw;
if c>hc then dzy:sell(1,holding,market);
if c<lc then kzy:sellshort(1,holding,market);
if len2>0 then dzs:sell(1,holding,market);
if len1>0 then kzs:sellshort(1,holding,market); |