S:=CROSS (closing, EMA2 (high, 30));
X:=CROSS(EMA2 (low, 30), close);
WS:= bars last(S)+ 1;
WX:= bars last(X)+ 1;
SS:=CROSS(SUM(S,WX),0.5);
XX:=CROSS(SUM(X,WS),0.5);
Adhesion line (closed & gtEMA2 (high, 30), EMA2 (high, 30), EMA2 (low, 30), COLORMAGENTA,1);
Adhesion line (closed & ltEMA2 (low, 30), EMA2 (low, 30), EMA2 (high, 30), COLORRED,1);
Adhesion line (closed & gtEMA2 (high, 150), EMA2 (high, 150), EMA2 (low, 150), COLORLIGHTBLUE,1);
Adhesion line (closed & ltEMA2 (low, 150), EMA2 (low, 150), EMA2 (high, 150), COLORLIGHTGREEN,1);
PARTLINE(CLOSE & gt; EMA2 (height, 30), EMA2 (height, 30), Color Magenta);
PARTLINE(CLOSE & lt; EMA2 (high, 30), EMA2 (high, 30), color red);
PARTLINE(CLOSE & gt; EMA2 (low, 30), EMA2 (low, 30), Color Magenta);
PARTLINE(CLOSE & lt; EMA2 (low, 30), EMA2 (low, 30), color red);
PARTLINE(CLOSE & gt; EMA2 (high, 150), EMA2 (high, 150), colored);
PARTLINE(CLOSE & lt; EMA2 (high, 150), EMA2 (high, 150), color light green);
PARTLINE(CLOSE & gt; EMA2 (low, 150), EMA2 (low, 150), color light blue);
PARTLINE(CLOSE & lt; EMA2 (low, 150), EMA2 (low, 150), color light green);
Glue line (OPEN & gt=CLOSE, CLOSE, open, COLORBLUE, 0);
Adhesion line (CLOSE & gt=OPEN, close, OPEN, COLORCYAN, 0);
DRAWTEXT(SS, LOW,' buy');
DRAWTEXT(XX,HIGH,' sell ');