通达信公式实战KDJ
SHORT:=12;
LONG:=26;
MID:=9;
M:=3;
DIFF:=EMA(CLOSE,35)-EMA(CLOSE,70);
DEAA:=EMA(DIFF,12);
MACD:DIFF,COLORSTICK;
DIF1:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA1:=EMA(DIF1,9);
DIF2:=DIF1,COLOR33FF33;
DEA2:=DEA1,COLORYELLOW;
IF(DIF1>=DEA1,DIF1,DRAWNULL),COLORRED,LINETHICK2;
WXS:=(LONG-SHORT)/2;
JGL_DF:=WXS*(EMA(CLOSE,SHORT)-REF(EMA(CLOSE,SHORT),1));
DIF:EMA(JGL_DF,LONG),COLOR1234AA,LINETHICK3;
DEA:EMA(DIF,MID),COLOR338833,LINETHICK3;
MACD_L:=(DIF-DEA)*2,COLORA9A813,COLORSTICK;
K:SMA(JGL_DF,M,1)*1,COLORFEDCBA;
D:SMA(K,M,1),COLOR13F8F9;
J:3*K-2*D,COLORF813F9;
RF:=REF(J,1);
DJ:=ABS(J-RF);
MM:=(HHV(DJ,240)+LLV(DJ,240))/2;
STICKLINE(J>RF,J,RF,2.3,0),COLOR1388D3;
STICKLINE(J>RF,J,RF,1.0,0),COLOR13AAD3;
STICKLINE(J<RF,J,RF,2.3,0),COLOR338833;
STICKLINE(J<RF,J,RF,1.0,0),COLOR33AA33;
STICKLINE(J<RF AND DJ<0.2*MM,J-0.1*MM,RF+0.1*MM,0.1,0),COLOR33AA33;
STICKLINE(J>=RF AND DJ<0.2*MM,J+0.1*MM,RF-0.1*MM,0.1,0),COLOR13AADD;