[PEL] 复制代码
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
macd:2*(DIF-DEA),COLORSTICK;
JC26:=CROSS(DIF,DEA);
SC26:=CROSS(DEA,DIF);
N126:=BARSLAST(JC26)+1;
N226:=BARSLAST(SC26)+1;
MHD:=VALUEWHEN(CROSS(DEA,DIF),HHV(DIF,N126));
MHD2:=VALUEWHEN(CROSS(DEA,DIF),REF(MHD,1));
HH:=VALUEWHEN(CROSS(DEA,DIF),HHV(H,N126));
HH2:=VALUEWHEN(CROSS(DEA,DIF),REF(HH,1));
MLD:=VALUEWHEN(CROSS(DIF,DEA),LLV(DIF,N226));
MLD2:=VALUEWHEN(CROSS(DIF,DEA),REF(MLD,1));
LL:=VALUEWHEN(CROSS(DIF,DEA),LLV(L,N226));
LL2:=VALUEWHEN(CROSS(DIF,DEA),REF(LL,1));
A26:=CROSS(DEA,DIF)&&HH>HH2&&MHD<=MHD2;
B26:=CROSS(DIF,DEA)&&LL<LL2&&MLD>=MLD2;
DRAWSL(B26 ,MLD2,0,-SUMBARS(CROSS(DIF,DEA),2)+1,0,COLORRED);
DRAWLINE(B26,MLD2,1,MLD,0,COLORRED);
DRAWTEXT(B26,MLD2,'底背'),VALIGN0,COLORRED;
DRAWSL(A26,MHD2,0,-SUMBARS(CROSS(DEA,DIF),2)+1,0,COLORGREEN);
DRAWLINE(A26 ,MHD2,1,MHD,0,COLORGREEN);
DRAWTEXT(A26,MHD2,'顶背',COLORGREEN,2);