长短KDJ源码公式中,讲解的是kdj中的两条线,主要是K线和d线的走势变化,基本的源码解析如下:
N:=18;M1:=5;M2:=6;M3:=46;M4:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);
短线:=3*K-2*D;
PARTLINE(短线,短线>REF(短线,1),RGB(255,0,0),短线
K1:=SMA(RSV,M3,1);
D1:=SMA(K1,M4,1);
长线:=3*K1-2*D1;
STICKLINE(长线>REF(长线,1),50,50+10,8,1),colorred;
将其基本的源代码导入到软件中进行分析,其中的走势只有两条线,对应的走势如下图所示:
如果想要细细的品味长短线KDJ指标公式的应用,可以结合下面的源码进行分析,其中的走势有相似的部分:
RSVD:=(INDEXC-LLV(INDEXL,19))/(HHV(INDEXH,19)-LLV(INDEXL,19))*100;
KD:=SMA(RSVD,3,1);
DD:=SMA(KD,3,1);
J1:="KDJ.J"(27,5,3),colorred;
PARTLINE(J1,J1>REF(J1,1),RGB(250,10,10),J1<=REF(J1,1),RGB(250,250,250)),LINETHICK3;
STICKLINE(KD>=DD,KD,DD,10,0),Color0000BF;
STICKLINE(KD>=DD,KD,DD,6,0),Color0000E1;
STICKLINE(KD>=DD,KD,DD,4,0),Color1111FF;
STICKLINE(KD>=DD,KD,DD,2,0),Color3D3DFF;//红色
STICKLINE(KD
STICKLINE(KD
STICKLINE(KD
STICKLINE(KD
RSV:=(CLOSE-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13))*100;
K:=SMA(RSV,3,1),colorwhite;
D:=SMA(K,3,1),coloryellow;
STICKLINE(K>=D,K,D,10,0),Color00BFBF;
STICKLINE(K>=D,K,D,6,0),Color00E8E8;
STICKLINE(K>=D,K,D,4,0),Color1AFFFF;
STICKLINE(K>=D,K,D,2,0),Color3EFFFF;//黄色
STICKLINE(K
STICKLINE(K
STICKLINE(K
STICKLINE(K
买卖:= EMA((-3)*(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14))+2.7,9);
STICKLINE(买卖<0,k,d,10,0),ColorBD00BD;
STICKLINE(买卖<0,k,d,8,0), ColorE300E3;
STICKLINE(买卖<0,k,d,6,0), ColorFF11FF;
STICKLINE(买卖<0,k,d,2,0), ColorFF3EFF;//粉色
STICKLINE(买卖>2,k,d,10,0),ColorB70000;
STICKLINE(买卖>2,k,d,6,0), ColorE30000;
STICKLINE(买卖>2,k,d,4,0), ColorFF0B0B;
STICKLINE(买卖>2,k,d,2,0), ColorFF3C3C;//蓝色
卖线:85,LINETHICK02,POINTDOT,Color15FF15;
界线:50,LINETHICK02,POINTDOT,ColorFF1EFF;
买线:10,LINETHICK02,POINTDOT,Color28FFFF;
这样的代码中包含了基本的买卖点以及风险操作的提示位置,具体的形态如下:
上面的源码公式不仅仅是买线与卖线的形态区域,还有股价与指标顶底背离的指标公式图形和相关的代码编写:
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)
底背离:=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:=dREF(d,2);
A2:=BARSLAST(REF(q2,1));
顶背离:= REF(q1,A2+1)
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;
其中讲解的相关的安全区与风险区的位置,同时也点明了底背离和顶背离的走势形态和源码介绍,将其导入软件中的走势是可以判断买点和卖点位置的。
TAG:kdj指标公式