小天K—KDJ指标是一个很久的指标了,但也很有参考价值。
第二代小天K-KDJ 附设计原理,附一代公式和小天K-KDJ-II双剑合璧
或者在www.fxjgsw.com搜索一下:小天,就能找d:
http://www.fxjgsw.com/search.asp?m=0&s=0&word=%D0%A1%CC%EC&x=14&y=12
附件是详细的用法说明,公式请在上面的链接下载。
但介绍的很不完整,也不大好理解。现提供源码和用法详解,详解请下载。
源码如下:
先建一个引入指标
{XTYY}
a1:close;
a2:high;
a3:low;
{ 二代小天K-KDJ }
input: N(8,1,100),M(55,1,100);
zc:=STKINDI(STKLABEL,'xtyy.a1',0,7);//引用周收盘价;
zh:=STKINDI(STKLABEL,'xtyy.a2',0,7);//引用周最高价;
zl:=STKINDI(STKLABEL,'xtyy.a3',0,7);//引用周最低价;
RSV:=(zc-LLV(zl,n))/(HHV(zh,n)-LLV(zl,n))*100;
K:=eMA(RSV,3);
D:=eMA(K,3);
J:=3*K-2*D;
RSV24:=(CLOSE-LLV(LOW,m))/(HHV(HIGH,m)-LLV(LOW,m))*100;
K24:=SMA(RSV24,3,1);
D24:=SMA(K24,3,1);
J24:=3*K24-2*D24;
支撑:IF(CROSS(j,j24),L,REF(L,BARSLAST(CROSS(j,j24)))),COLORYELLOW;
压力:IF(CROSS(j24,j),H,REF(H,BARSLAST(CROSS(j24,j)))),COLorred;
U2L:=IF(C>=MA(C,21),80,50);
L2L:=IF(C>=MA(C,21),50,20);
RH1:=IF(j<U2L AND REF(j,1)>=U2L,HHV(REF(H,1),BARSLAST(j>=U2L AND REF(j,1)<U2L)-1),
REF(HHV(REF(H,1),BARSLAST(j>=U2L AND REF(j,1)<U2L)-1),BARSLAST(j<U2L AND REF(j,1))));
RH4:=IF(H>RH1,L,REF(L,BARSLAST(H>RH1)));
RH42:=IF(H>RH1,j,REF(j,BARSLAST(H>RH1)));
强压:IF(H>RH4 AND j<RH42 AND j<j24,H,REF(H,BARSLAST(H>RH4 AND j<RH42 AND j<j24))),COLORgreen;
RL1:=IF(j>L2L AND REF(j,1)<=L2L,LLV(REF(L,1),BARSLAST(j<=L2L AND REF(j,1)>L2L)-1),
REF(LLV(REF(L,1),BARSLAST(j<=L2L AND REF(j,1)>L2L)-1),BARSLAST(j>L2L AND REF(j,1))));
RL4:=IF(L<RL1,H,REF(H,BARSLAST(L<RL1)));
RL42:=IF(L<RL1,j,REF(j,BARSLAST(L<RL1)));
强撑:IF(L<RL4 AND j>RL42 AND j>j24,L,REF(L,BARSLAST(L<RL4 AND j>RL42 AND j>j24))),COLORMAGENTA;
STICKLINE(c>=o,l,h,0.1,0),colorred;
STICKLINE(c>=o,o,c,7,1),colorred;
STICKLINE(c<=o,l,h,0.1,0),colorcyan;
STICKLINE(c<=o,o,c,7,0),colorcyan;
由于这是修改了的,有些线标的不明,故此我修改了一下,你再对照下详解就能更好的理解了。修改码如下:(引用指标还是要建的)
input: N(8,1,100),M(55,1,100);
zc:=STKINDI(STKLABEL,'xtyy.a1',0,7);//引用周收盘价;
zh:=STKINDI(STKLABEL,'xtyy.a2',0,7);//引用周最高价;
zl:=STKINDI(STKLABEL,'xtyy.a3',0,7);//引用周最低价;
RSV:=(zc-LLV(zl,n))/(HHV(zh,n)-LLV(zl,n))*100;
K:=eMA(RSV,3);
D:=eMA(K,3);
J:=3*K-2*D;
RSV24:=(CLOSE-LLV(LOW,m))/(HHV(HIGH,m)-LLV(LOW,m))*100;
K24:=SMA(RSV24,3,1);
D24:=SMA(K24,3,1);
J24:=3*K24-2*D24;
支撑:IF(CROSS(j,j24),L,REF(L,BARSLAST(CROSS(j,j24)))),COLORYELLOW;
压力:IF(CROSS(j24,j),H,REF(H,BARSLAST(CROSS(j24,j)))),COLORBLUE;
U2L:=IF(C>=MA(C,21),80,50);
L2L:=IF(C>=MA(C,21),50,20);
RH1:=IF(j<U2L AND REF(j,1)>=U2L,HHV(REF(H,1),BARSLAST(j>=U2L AND REF(j,1)<U2L)-1),
REF(HHV(REF(H,1),BARSLAST(j>=U2L AND REF(j,1)<U2L)-1),BARSLAST(j<U2L AND REF(j,1))));
RH4:=IF(H>RH1,L,REF(L,BARSLAST(H>RH1)));
RH42:=IF(H>RH1,j,REF(j,BARSLAST(H>RH1)));
强压RH5:IF(H>RH4 AND j<RH42 AND j<j24,H,REF(H,BARSLAST(H>RH4 AND j<RH42 AND j<j24))),COLORgreen;
RL1:=IF(j>L2L AND REF(j,1)<=L2L,LLV(REF(L,1),BARSLAST(j<=L2L AND REF(j,1)>L2L)-1),
REF(LLV(REF(L,1),BARSLAST(j<=L2L AND REF(j,1)>L2L)-1),BARSLAST(j>L2L AND REF(j,1))));
RL4:=IF(L<RL1,H,REF(H,BARSLAST(L<RL1)));
RL42:=IF(L<RL1,j,REF(j,BARSLAST(L<RL1)));
强撑RL5:IF(L<RL4 AND j>RL42 AND j>j24,L,REF(L,BARSLAST(L<RL4 AND j>RL42 AND j>j24))),COLORMAGENTA;
STICKLINE(c>=o,l,h,0.1,0),colorred;
STICKLINE(c>=o,o,c,7,1),colorred;
STICKLINE(c<=o,l,h,0.1,0),colorcyan;
STICKLINE(c<=o,o,c,7,0),colorcyan;
详解图片:
没办法,发不了图,
|