DIFF:((EMA(CLOSE,12) - EMA(CLOSE,26))),LINETHICK2;
DEA : EMA(DIFF,9);
MACD : 2*(DIFF-DEA), COLORSTICK;
RMACD:=REF(MACD,1);
CK2:=IF(MACD>RMACD,1,IF(MACD<RMACD,2,0));
CK2A:=REF(CK2,BARSLAST(CK2<>0));
STICKLINE(( MACD>0 AND CK2A=1),0,MACD,3,0),colorred,LINETHICK2;
STICKLINE(( MACD>0 AND CK2A=2),0,MACD,1,0),colorCCFF66,LINETHICK2;
STICKLINE((MACD<0 AND CK2A=1 ),0,MACD,1,0),colorblue,LINETHICK2;
STICKLINE((MACD<0 AND CK2A=2 ),0,MACD,3,0),colorgreen,LINETHICK2;
DIFF1降:IF(DIFF<REF(DIFF,1),DIFF,DRAWNULL),colorgreen,LINETHICK2;
DEA1降:IF(DEA<REF(DEA,1),DEA,DRAWNULL),colormagenta;