LONG:=26;SHORT:=12;M:=9;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
macd : 2*(DIFF-DEA), COLORSTICK,COLOR5454FF;
DD:=C=HHV(C,180);
EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;
CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;
上升背离:(CC AND EE)*DEA,COLOR00FFFF;
{- }
顶背离:DD AND EE AND (DEA
GG:= DEA> REF(DEA,1) AND REF(DEA> REF(DEA,1),1)=1;
LL:=C< REF(C,1) AND REF(C< REF(C,1),1)=1;
下降背离:LL AND GG*DEA,COLORMAGENTA;
底背离:FF AND GG AND DEA> LLV(DEA,180)*DEA,STICK,LINETHICK3,COLORRED;
MM:=IF(MacD< 0,MACD,0);
JJ:=MM> REF(MM,1);
ZZ:=REF(JJ,1)=1;
介入区:JJ AND ZZ*DEA,POINTDOT,COLORGREEN;{MACD蓝柱缩短---指今日比昨天短}
STICKLINE(介入区=DEA,DEA,DIFF,3,0),COLORRED;
DRAWTEXT(crOSS(DIFF,DEA ),0,'金N叉'),COLORCYAN;
DRAWTEXT(CROSS(DEA,DIFF ),0,'死叉'),COLORGREEN;