DIFF:=EMA(CLOSE,9) - EMA(CLOSE,26);
DEA:=EMA(DIFF,12);
金叉:=crOSS(DIFF,DEA);
M1:=BArslAST(金叉);
M2:=REF(BARSLAST(金叉),M1+1);
M3:=REF(BARSLAST(金叉),M2+M1+2);
CH1:=HHV(C,M1+1);
DIFH1:=HHV(DIFF,M1+1);
CH2:=REF(CH1,M1+1);
DIFH2:=REF(DIFH1,M1+1);
CH3:=REF(CH2,M1+1);
DIFH3:=REF(DIFH2,M1+1);
pdiFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1);
mdiFH2:=INTPART(DIFH2/POW(10,PDIFH2));
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1);
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3));
MDIFT2:=INTPART(DIFF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIFF/POW(10,PDIFH3));
直接顶背离:=(CH1>CH2 ) AND (MDIFT2
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT3
TG:=((MDIFT2
成:FILTER(TG,20);