N1:=7;
N2:=14;
LC := REF(CLOSE,1);
R1:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
R2:=SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;
DRAWTEXT(CROSS(R1,80),H,'减'),VALIGN2,ALIGN1,FONTSIZE15,COLORGREEN;
DRAWTEXT(CROSS(R2,85)&&R1>85,H,'减2'),VALIGN2,ALIGN1,FONTSIZE15,COLORGREEN;
DRAWTEXT(CROSS(20,R1),L,'减'),VALIGN0,ALIGN1,FONTSIZE15,COLORYELLOW;
DRAWTEXT(CROSS(15,R2)&&R1<15,L,'减2'),VALIGN0,ALIGN1,FONTSIZE15,COLORYELLOW;
A:=(3*C+L+O+H)/6;
B:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+14*REF(A,6)+13*REF
(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)+7*REF(A,13)+6*REF
(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+REF(A,20))/210;
D:=MA(B,10);
//DRAWHORIZONTALLINE(CROSSDOWN(B , D), REF(B,1),RGB(0,128,255));
//DRAWHORIZONTALLINE(CROSS(B , D), REF(B,1),RGB(0,128,255));
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA),COLORSTICK;
JC:=CROSS(DIFF,DEA);
SC:=CROSSDOWN(DIFF,DEA);
N10:=BARSLAST(JC)+1,NODRAW;
N20:=BARSLAST(SC)+1,NODRAW;
NN1:=HHVBARS(H,N10),NODRAW;
DRAWHORIZONTALLINE(CROSS(A1,0.5),L,COLORRED),POINTDOT,LINETHICK2;
DRAWHORIZONTALLINE(CROSS(B1,0.5),H,COLORLIGHTGREEN),POINTDOT,LINETHICK2;
DRAWNUMBER1(REFX(CROSS(A1,0.5),1),VALUEWHEN(CROSS(A1,0.5),L),VALUEWHEN(CROSS
(A1,0.5),L),0),COLORRED;
DRAWNUMBER1(ISLASTBAR,VALUEWHEN(CROSS(B1,0.5),H),VALUEWHEN(CROSS
(B1,0.5),H),0),COLORLIGHTGREEN;