N:=9;
A1:=EMA(EMA(EMA(EMA(EMA(EMA(CLOSE,3),3),3),3),3),20);
B1:=(A1-REF(A1,1))/REF(A1,1)*100;
C1:SUM(B1,N);
A2:=EMA(EMA(EMA(EMA(EMA(CLOSE,12),12),12),12),12);
B2:=(A2-REF(A2,1))/REF(A2,1)*100;
C2:SUM(B2,N);
A3:=EMA(EMA(EMA(CLOSE,18),18),18);
B3:=(A3-REF(A3,1))/REF(A3,1)*100;
C3:SUM(B3,N);
STICKLINE(C2>REF(C2,1),C2,C3,0,0),COLORRED;
STICKLINE(C2<REF(C2,1),C2,C3,0,0),COLORGREEN;
STICKLINE(C1>REF(C1,1),C1,C3,0,0),COLORRED;
STICKLINE(C1<REF(C1,1),C1,C3,0,0),COLORGREEN;
DRAWTEXT(crOSS(C1,REF(C1,1)) AND C1>C3,C1,'买点'),COLORRED;
DRAWTEXT(CROSS(C1,C2) AND C1>C3 AND C1>C2,C1,'买点'),COLORRED;