以下是通达信海盗KDJ源码副图
{N 1 300 12;
M1 1 300 3
M2 1 300 3};
超买线:80,COLORGREEN;
中间线:50,COLORWHITE;
超卖线:20,COLORRED;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1),LINETHICK0,COLORGREEN;
D:=SMA(K,M2,1),LINETHICK0;
J:=3*K-2*D,LINETHICK0;
STICKLINE(K>=D,K,D,1,1),COLORRED;
STICKLINE(K<D,K,D,1,1),COLORGREEN;
DRAWTEXT(K>D AND ISLASTBAR,50,'持股'),COLORRED;
DRAWTEXT(K<D AND ISLASTBAR,35,'休息'),COLORGREEN;
DRAWTEXT(K>80 AND ISLASTBAR,80,'超买'),COLORGREEN;
DRAWTEXT(K<20 AND ISLASTBAR,20,'超卖'),COLORRED;
DRAWICON(CROSS(K,D)AND K<20,K*0.9,1);
VAR1:=IF(COUNT(J<0,3)=3,1,0);
VAR2:=IF(COUNT(J>100,3)=3,1,0);
底:STICKLINE(VAR1,0,7,15,1),COLORRED;
顶:STICKLINE(VAR2,98,90,15,1),COLORGREEN;