DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
前高:=DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORWHITE;
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
前低:=DRAWLINE(VA4,MACD,REF(VA4,1),REF(MACD,1),1),COLORYELLOW;
X:IF(COUNT(MACD>0,BARSLAST(VA2))=BARSLAST(VA2),DRAWLINE(VA2,H,REF(VA2,1),REF(H,1),1),
DRAWNULL),COLORGREEN,LINETHICK2;
STICKLINE(MACD>0 AND C>X AND O>X,C,O,1,0),COLORRED;
STICKLINE(MACD>0 AND C>X AND O<X,C,X,1,0),COLORRED;
STICKLINE(MACD>0 AND MACD>前高,C,O,1,0),COLORYELLOW;
STICKLINE(REFX(VA2,1) OR REFX(VA4,1),C,O,1,0),COLORGREEN;
JC:=CROSS(DIF,DEA);
JTS:=BARSLAST(DIF<DEA);
SC:=CROSS(DEA,DIF);
STS:=BARSLAST(DIF>DEA);
价格低点:IF(JTS>0,DRAWLINE(JC,L,REF(JC,1),REF(L,1),1),DRAWNULL),COLORMAGENTA,LINETHICK2;
价格高点:IF(STS>0,DRAWLINE(SC,H,REF(SC,1),REF(H,1),1),DRAWNULL),COLORYELLOW,LINETHICK2;
JGGD:=DRAWLINE(SC,H,REF(SC,1),REF(H,1),1);
WW:=BARSLAST(VA4)<=REF(IF(VA4,BARSNEXT(JC),DRAWNULL),BARSLAST(VA4));
指标低点:IF(WW,DRAWLINE(VA4,L,REF(VA4,1),REF(L,1),1),DRAWNULL),COLORWHITE,LINETHICK2;
白线:=DRAWLINE(VA4,L,REF(VA4,1),REF(L,1),1);
STICKLINE(MAX(C,O)<指标低点,C,O,1,0),COLORWHITE;
STICKLINE(MAX(C,O)>指标低点 AND MIN(C,O)<指标低点,指标低点,MIN(C,O),1,0),COLORWHITE;
STICKLINE(价格低点<白线 AND MAX(C,O)>价格低点 AND MIN(C,O)<价格低点,价格低点,
MIN(C,O),1,0),COLORMAGENTA;
STICKLINE(价格低点<白线 AND MAX(C,O)<价格低点,C,O,1,0),COLORMAGENTA;
DRAWTEXT(价格低点<白线 AND O<价格低点 AND C>价格低点 AND MACD>REF(MACD,1) AND
REF(C,1)<价格低点 AND JTS>1,L*0.99,'挖坑结束、还需确认'),COLORYELLOW;
DRAWTEXT(JC AND 价格低点>JGGD,L*0.99,'小心筑顶、红柱保护');
DRAWTEXT(NOT(WW) AND C>价格高点 AND O<价格高点,L*0.99,'简单骗术、时间和谐');
DRAWTEXT(WW AND C>价格高点 AND O<价格高点,L*0.99,'再涨一段、注意真假'),COLORYELLOW;