P1:=5;
P2:=30;
A1:=MA(CLOSE,P1);A2:=REF(A1,1);J1:(A1-A2)/A2*100;MJ1:MA(J1,3);
A3:=MA(CLOSE,P2);A4:=REF(A3,1);J2:(A3-A4)/A4*100;MJ2:=MA(J2,10);
A5:=MA(C,10);A6:=REF(A5,1);
J3:=(A5-A6)/A6*100;Mj3:=MA(j3,5);
{向上拐点:IF(COUNT(crOSS(j1,0),3)>=1 AND mj1>mj3 AND mj3>REF(mj3,1) AND J3>=0 AND J1>REF(j1,1),5,0) ,colorred,linethick2;
向下拐点:IF(CROSS(0,j1)>=1 AND mJ3<REF(mj3,1) AND mJ2<REF(mj2,2) AND mJ3<mJ2,-5,0),colorgreen,linethick2;}
0,colorwhite;
STICKLINE(J1>0 AND J2>0,J1,0,2,0),colorred;
STICKLINE(J1<0 AND J2>0,0,J1,2,0),coloryellow;
STICKLINE(J1>0 AND J2<0,J1,0,2,0),colormagenta;
STICKLINE(J1<0 AND J2<0,0,J1,2,0),colorgreen;
DRAWICON(CROSS(J1,mJ1) AND COUNT(mj1<-3,3)>=1 ,J1*1.5,1);
DRAWICON(CROSS(mJ1,J1) AND COUNT(mj1>3,3)>=1,J1*1.8,2);
选股:IF(CROSS(J1,mJ1) AND COUNT(mj1<-2,3)>=1,2,0),coloryellow,linethick2;
B1:=BArslAST(REF(CROSS(J1,MJ1) AND MJ1<0,1));
底背离:=REF(CLOSE,B1+1)>CLOSE AND J1>REF(J1,B1+1) AND CROSS(J1,MJ1);
DRAWLINE(B1=0,MJ1,底背离,MJ1,0),colorred,linethick3;
B2:=BARSLAST(REF(CROSS(MJ1,J1) AND MJ2>0,1));
顶背离:=REF(CLOSE,B2+1)<CLOSE AND REF(MJ1,B2+1)>J1 AND CROSS(MJ1,J1);
DRAWLINE(B2=0,MJ1,顶背离,MJ1,0),colorwhite,linethick2;