N:=5;
M:=3;
TR:= EMA(EMA(EMA(CLOSE,N),N),N);
TRIX:(TR-REF(TR,1))/REF(TR,1)*100;
TRMA:MA(TRIX,M);
DRAWICON(CROSS(TRIX,TRMA),TRIX ,"up");
DRAWICON(CROSS(TRMA,TRIX),TRMA ,"down");
WY1001:=(2*CLOSE+HIGH+LOW)/4;
WY1002:=EMA(WY1001,4);
WY1003:=EMA(WY1002,4);
WY1004:=EMA(WY1003,4);
XYS0:=(WY1004-REF(WY1004,1))/REF(WY1004,1)*100;
XYS1:MA(XYS0,2);
XYS2:MA(XYS0,1);
DRAWICON(CROSS(XYS1,XYS2),XYS1 ,"SELL");
DRAWICON(CROSS(XYS2,XYS1),XYS2 ,"BUY");