MA1:=MA((HIGH+LOW)/2,5);
MA2:=MA((HIGH+LOW)/2,35);
OSC:=MA1-MA2,LINETHICK0,COLORSTICK;
OSCE:=EMA(OSC,1);
DIF : EMA(OSCE,12) - EMA(OSCE,26);
BBDIF:=DIF-REF(DIF,1);
DEA : EMA(DIF,9);
DRAWBAND(DIF,RGB(255,105,180),DEA,RGB(34,139,34));
BBDEA:=DEA-REF(DEA,1);
MACD : 2*(DIF-DEA), COLORSTICK;
STICKLINE(MACD0,0,MACD,2,0),COLORFFFF00;
STICKLINE(MACD
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0),COLOR0099FF;
STICKLINE(MACD>REF(MACD,1)AND MACD>0,0,MACD,2,0),COLORRED;
0,COLORFF8855,LINETHICK2;
UPO:=IF(DIF>=0,DIF,DRAWNULL);
DNO:=IF(DIF<=0,DIF,DRAWNULL);
UP:EMA(UPO,35+5/1.618),COLORFF9900,LINETHICK2;
DN:EMA(DNO,35+5/1.618),COLORFF9900,LINETHICK2;
DIFF3 := EMA(OSCE,12) - EMA(OSCE,26);
DEA3 := EMA(DIFF3,9);
MACD3 := 2*(DIFF3-DEA3), COLORSTICK;
JC := DEA3-DIFF3;
绿柱面积:=IF(MACD3<0,SUM(MACD3,BARSLAST(JC<0)),0);
红柱面积:=IF(MACD3>0,SUM(MACD3,BARSLAST(JC>0)),0);
本次最低价:=LLV(L,BARSLAST(JC<0));
本次最高价:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD3<0,BARSLAST(CROSS(DIFF3,DEA3)),0);
前次绿柱面积:=REF(绿柱面积,X1+1);
前次最低价:=REF(本次最低价,X1+1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)
AND 本次最低价<前次最低价 ),1,0);
RS1:= MACD3<0 AND REF(MACD3,1)<0 AND C<前次最低价
AND ABS(绿柱面积)
底背驰:= IF (CROSS(DIFF3,DEA3),REF(Y1,1),0);
DRAWTEXT(底背驰,0.08,'积底背'),COLOR00FFFF;
STICKLINE(底背驰,0,0.08,4,0),COLOR0000FF;
DRAWICON(底背驰,0,23),COLORYELLOW;
X2:=IF (MACD3>0,BARSLAST(CROSS(DEA3,DIFF3)),0);
前次红柱面积:=REF(红柱面积,X2+1);
前次最高价:=REF(本次最高价,X2+1);
Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
RS2:= MACD3>0 AND REF(MACD3,1)>0 AND C>前次最高价 AND ABS(红柱面积)
顶背驰:= IF (CROSS(DEA3,DIFF3),REF(Y2,1),0);
DRAWICON(顶背驰,0,19),COLOR00FF00;
STICKLINE(顶背驰,0,-0.08,4,0),COLOR00FF00;
DRAWTEXT(顶背驰,-0.08,'积顶背'),COLORFF0000;