N1:=5;
N2:=10;
N3:=30;
SHORT:=12;
LONG:=26;
MID:=9;
MA5:=MA(CLOSE,N1),LINETHICK2,COLORRED;
MA10:=MA(CLOSE,N2),LINETHICK2,COLORGREEN;
MA30:=MA(CLOSE,N3),LINETHICK2,COLORBLUE;
VVOL:VOL,COLORSTICK;
DIFF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG),COLORWHITE;
DEA:EMA(DIFF,MID),COLORYELLOW;
MACD:(DIFF-DEA)*2,COLORSTICK;
BUY1:=CROSS(DIFF,DEA) AND VOL>REF(VOL,1);
STICKLINE(BUY1,0,MACD,3,0),COLORRED;
持仓:IF(CLOSE>MA30,MA30,DRAWNULL),COLORMAGENTA,LINETHICK8;
空仓:IF(CLOSE<=MA30,MA30,DRAWNULL),COLORGREEN ,LINETHICK8;
DRAWTEXT(BUY1,VOL*0.995,' ★买'),COLORYELLOW;
DRAWICON(BUY1,VOL, 9);