KDJ背离副图 源码
KDJ背离提示显示的指标 和同花顺原版的一样 只是原版的在指标中是上下绿线和蓝线之间 这个会过了绿线和蓝线走一点 要是按照原版的算钝化就是在刚过绿线和蓝线开始算。一样用 顶背离和底背离叉上后显示!见图!
源码
N:=9;M1:=3;M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1),coloryellow,LINETHICK1;
D:SMA(K,M2,1),colorcyan,LINETHICK1;
J:3*K-2*D,colormagenta,LINETHICK1;
高安全区:0,colorred;
安全区:20,colorcyan;
风险区:100,colorgreen;
U1:=BARSLAST(REF(CROSS(K,D),1));
U2:=REF(C,U1+1) C AND REF(K,U1+1) K AND CROSS(K,D)AND d
底背离:=IF(U2 0,1,0);
DRAWLINE(U1=0,D,底背离,REF(D,U1),0),colorred,LINETHICK2;
DRAWLINE(底背离,D,底背离,REF(D,U1),0),colorred,LINETHICK2;
DRAWTEXT(底背离,REF(D,U1)*1.00,' 底背离'),coloryellow;
rr:=MAX(C,O);
q1:=HHV(rr,5);
q2:=d REF(d,1) AND REF(d,1) REF(d,2);
A2:=BARSLAST(REF(q2,1));
顶背离:= REF(q1,A2+1) q1 AND k REF(k,A2+1) AND q2;
DRAWLINE(A2=0 ,D,顶背离,REF(D,A2),0),colorwhite,LINETHICK2;
DRAWLINE(顶背离,D,顶背离,REF(D,A2),0),colorwhite,LINETHICK2;
DRAWTEXT(顶背离,REF(D,A2)*1.02,' 顶背离'),colorgreen;