[PEL] 复制代码
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:(DIFF-DEA)*2,COLORSTICK;
JC26:=CROSS(DIFF,DEA);
SC26:=CROSS(DEA,DIFF);
N126:=BARSLAST(JC26)+1;
N226:=BARSLAST(SC26)+1;
MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(DIFF,N226));
MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
DRAWLINE(CROSS(DIFF,DEA),LLV(DIFF,N226),底背离,MLD2,0),COLORRED;
STICKLINE(底背离,DIFF,MLD2,0,0),COLORRED;
DRAWTEXT(底背离,MLD2,'底背离'),COLORRED;
HH:=VALUEWHEN(CROSS(DEA,DIFF),HHV(DIFF,N126));
HH2:=VALUEWHEN(CROSS(DEA,DIFF),REF(HH,1));
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(CROSS(DEA,DIFF),HHV(DIFF,N126),顶背离,HH2,0),COLORGREEN;
STICKLINE(顶背离,DIFF,HH2,0,0),COLORGREEN;
DRAWTEXT(顶背离,HH2,'顶背离'),COLORGREEN;