{KDJ信号}
{左侧交易指标,短线}
STICKLINE(C,50,20,10,0),COLOR996600;
STICKLINE(C,80,50,10,0),COLOR996600;
STICKLINE(C,100,100,10,0),COLOR996600;
STICKLINE(C,0,0,10,0),COLOR996600;
STICKLINE(C,50,50,10,0),COLOR000000;
{KM组合}{根据股价调整N,默认1000}
系数:=N/1000;
B1:=(HHV(H,9)-C)/(HHV(H,9)-LLV(LOW,9))*100- 70;
B2:=SMA(B1,9,1)+100;
B3:=(C-LLV(L,9))/(HHV(H,9)- LLV(L,9))*100;
B4:=SMA(B3,3,1);
B5:=SMA(B4,3,1)+100;
B6:=B5-B2;
B7:=IF(B6>60,B6-60,0);
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26),COLORBLUE,LINETHICK2,NODRAW;
DEA1:=EMA(DIFF,9);
MACD:2*(DIFF-DEA1)*60,LINETHICK0,NODRAW;
S1:=MACD<REF(MACD,1)AND MACD>0,COLORBLUE;
S2:=MACD<REF(MACD,1) AND MACD<0;
STICKLINE(MACD>=0,MACD*系数,0,8,1),COLORRED;
STICKLINE(S1,0,MACD*系数,8,1),COLOR00FFFF;
STICKLINE(MACD<0,MACD*系数,0,8,1),COLOR996600;
STICKLINE(S2,0,MACD*系数,8,1),COLOR00AA00;
{长KDJ}
长RSV:=(((CLOSE - LLV(LOW,90)) / (HHV(HIGH,90) - LLV(LOW,90))) * 100);
长K:=SMA(长RSV,12,1),COLORWHITE,POINTDOT,LINETHICK4;
长D:SMA(长K,12,1),COLORYELLOW,POINTDOT,LINETHICK4,NODRAW;
长J:((3 * 长K) - (2 *长D)),COLORRED,POINTDOT,LINETHICK4;
STICKLINE(CROSS(长D,80),108,115,4,0),COLOR33FF33;
STICKLINE(CROSS(长D,15),0,10,4,0),COLOR3333AA;
{KDJ}
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));
DRAWICON(FILTER(CROSS(K,D)AND K<50,1),0,1);
STICKLINE(CROSS(90,J),108,115,4,0),COLORGREEN;
DRAWTEXT(CROSS(90,J),105,'抛'),COLORGREEN;
STICKLINE(CROSS(J,(0 - 5)),0,10,4,0),COLORCYAN;
DRAWTEXT(CROSS(J,(0 - 5)),(0 - 4),'吸'),COLORCYAN;
{KDJ背离}
AA2:=BARSLAST(REF(CROSS(K,D),1));
BB2:=REF(C,AA2+1)>C AND REF(K,AA2+1)<K AND CROSS(K,D);
KDJ底背离:STICKLINE(FILTER(BB2>0,5),0,1,3,0),COLORYELLOW;
DRAWTEXT(FILTER(BB2>0,5),-8,'底背离'),COLORYELLOW;
CC2:=BARSLAST(REF(CROSS(D,K),1));
DD2:=REF(C,CC2+1)<C AND REF(K,CC2+1)>K AND CROSS(D,K);
DRAWTEXT(FILTER(DD2>0,5),-8,'顶背离'),COLORGREEN;
{显示优化}
STICKLINE(REF(B7,1)<B7,J,REF(J,1),5,0),COLOR0090FF;
短K:K,COLORWHITE,LINETHICK2;
短D:D,COLORYELLOW,LINETHICK2;
短J:J,COLORMAGENTA,LINETHICK2;
金叉D:IF((K > D),D,DRAWNULL),COLORYELLOW,LINETHICK4;

 

看长做短KDJ(通达信)

 

看长做短KDJ(通达信)的选股公式如下: