N1:=3;
N2:=30;
M1:=3;
M2:=3;
DIF:=(EMA(CLOSE,N1)-EMA(CLOSE,N2))/(EMA(CLOSE,N2))*100,COLORBLUE,LINETHICK1;
K:SMA(DIF,M1,1);
D:SMA(K,M2,1);
J:K+1.0*(K-D);
DD:=2*K-2*D;
DOWN:IF(1,DD,DRAWNULL),STICK,,COLORGREEN,LINETHICK2;
UP:IF(DD>REF(DD,1),DD,DRAWNULL),STICK,,COLORRED,LINETHICK2;
DRAWICON(crOSS(J,K) AND DOWN>=0 AND J<5,J,1);
DRAWICON(CROSS(D,K) AND DOWN<=0,D,2);