DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),NODRAW;
MACDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
STICKLINE(MACDHS>0,0,MACD,2,0),colorred;
STICKLINE(MACDHX>0,0,MACD,2,0),coloryellow;
STICKLINE(MACDLX<0,MACD,0,2,0),colorcyan;
STICKLINE(MACDLS<0,MACD,0,2,0),colorligreen;
绿柱面积:10*IF (MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),NODRAW,colorcyan;
红柱面积:10*IF (MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),NODRAW,colorred;
DRAWNUMBER(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,8),REF(红柱面积,1)),colorred;
DRAWNUMBER(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),REF(ABS(绿柱面积),1)),colorcyan;
DRAWNUMBER(ISLASTBAR AND MACD<0,LLV(MACD,8),ABS(绿柱面积)),colorcyan;
DRAWNUMBER(ISLASTBAR AND MACD>0,HHV(MACD,4),ABS(红柱面积)),colorred;