文华wh6期货KDJ多空箭头顶底背离指标:KDJ线多空变色,交叉多空红绿箭头提示,顶底背离提示,坐标线
源码如下:
STICKLINE(1,20,20,100,0),COLORGRAY;
STICKLINE(1,50,50,100,0),COLORGRAY;
STICKLINE(1,80,80,100,0),COLORGRAY;
STICKLINE(1,100,100,100,0),COLORGRAY;
STICKLINE(1,0,0,100,0),COLORGRAY;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1);
D:SMA(K,3,1);
J:3*K-2*D;
N2:=5;
临界点:(HHV(HIGH,N2)-LLV(LOW,N2))*(3*D-2*K)/100+LLV(LOW,N2),NODRAW;
KD差:K-D,NODRAW;
叉价:(3*REF(D,1)-2*REF(K,1))*(HHV(HIGH,55)-LLV(LOW,55))/100+LLV(LOW,55),NODRAW;
乖离%:(CLOSE-叉价)/叉价*100,COLORRED,NODRAW;
DRAWICON(CROSS(J,K),K,’ICO4′);
DRAWICON(CROSS(K,J),D,’ICO5′);
金叉天:BARSLAST(K<D),NODRAW;
死叉天:BARSLAST(K>D),NODRAW;//{KD底背离}
A1:=BARSLAST(REF(CROSS(K,D),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND K>REF(K,A1+1) AND CROSS(K,D);
DRAWTEXT(底背离,K*0.6,’底背’);//{KD顶背离}
A2:=BARSLAST(REF(CROSS(D,K),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(K,A2+1)>K AND CROSS(D,K);
DRAWTEXT(顶背离,K*1.3,’顶背’);
A:=CROSS(EVERY(J>REF(J,1),2),0);
B:=CROSS(EVERY(J<REF(J,1),2),0);
DRAWCOLORLINE(BARSLAST(A)<BARSLAST(B),J,COLORMAGENTA,COLORYELLOW);
A5:=CROSS(EVERY(K>REF(K,1),2),0);
B5:=CROSS(EVERY(K<REF(K,1),2),0);
DRAWCOLORLINE(BARSLAST(A5)<BARSLAST(B5),K,COLORMAGENTA,COLORGREEN);
A6:=CROSS(EVERY(D>REF(D,1),2),0);
B6:=CROSS(EVERY(D<REF(D,1),2),0);
DRAWCOLORLINE(BARSLAST(A6)<BARSLAST(B6),D,COLORRED,COLORCYAN);