DIF:=EMA(CLOSE,12)-EMA(CLOSE,24);
DEA:=EMA(DIF,2);
macd:=(DIF-DEA)*2,COLORSTICK;
DIFD:=MacD.DIF#DAY;
DEAD:=MACD.DEA#DAY;
MACDD:=MACD.MACD#DAY;
DIFW:=MACD.DIF#WEEK;
DEAW:=MACD.DEA#WEEK;
MACDW:=MACD.MACD#WEEK;
DIFM:=MACD.DIF#MONTH;
DEAM:=MACD.DEA#MONTH;
MACDM:=MACD.MACD#MONTH;
DIFA:EMA((DIFD+7*DIFW+31*DIFM)/39,5);
DEAA:EMA((DEAD+7*DEAW+31*DEAM)/39,5);
MACDA:EMA((MACDD+7*MACDW+31*MACDM)/39,5) COLORSTICK;
IF(DIFA<REF(DIFA,1),DIFA,DRAWNULL) COLORGREEN LINETHICK2;
IF(DIFA>=REF(DIFA,1),DIFA,DRAWNULL) COLORRED LINETHICK2;
STICKLINE(MACDA<REF(MACDA,1),0,MACDA,0.1,1),COLOR00FF5B;
趋势维持线:EMA(DIFA,10)COLORGREEN LINETHICK2;
IF(DIFA>=趋势维持线,趋势维持线,DRAWNULL)COLORYELLOW,LINETHICK2;
DRAWBAND(DIFA,RGB(244,0,0),趋势维持线,RGB(250,215,0));
{DIF15:=MACD.DIF#MIN15;
DEA15:=MACD.DIF#MIN15;
MACD15:=MACD.MACD#MIN15;
DIF30:=MACD.DIF#MIN30;
DEA30:=MACD.DEA#MIN30;
MACD30:=MACD.MACD#MIN30;
DIF60:=MACD.DIF#MIN60;
DEA60:=MACD.DEA#MIN60;
MACD60:=MACD.MACD#MIN60;
DIFS:(DIF15*3+DIF30*6+DIF60*12)/21 LINETHICK3 COLORRED;
DEAS:(DEA15*3+DEA30*6+DEA60*12)/21 LINETHICK3 COLORGREEN;
MACDS:(MACD15*3+MACD30*6+MACD60*12)/21 COLORSTICK LINETHICK3;
DRAWICON(crOSS(DEAS,DIFS),DIFS,24);
IF(DIFS<REF(DIFS,1),DIFS,DRAWNULL) COLORBLUE LINETHICK4;};