KDJ指標公式原始碼:
引數:N:=9; M1:=3; M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1);
D:SMA(K,M2,1);
J:3*K-2*D;
周K:=MA("KDJ.K#WEEK"(N,M1,M2) ,5),LINETHICK1,COLORRED;
周D:=MA("KDJ.D#WEEK"(N,M1,M2) ,5),LINETHICK1,COLOR33FF99;
周J:=MA("KDJ.J#WEEK"(N,M1,M2) ,5),LINETHICK1,COLORMAGENTA;
月K:MA("KDJ.K#MONTH"(N,M1,M2),5),LINETHICK1,COLORFF00FF;
月D:MA("KDJ.D#MONTH"(N,M1,M2),5),LINETHICK1,COLOR00FF00;
月J:=MA("KDJ.J#MONTH"(N,M1,M2),5),LINETHICK1,COLORFFFFFF;
DRAWBAND(月K,RGB(100,0,100),月D,RGB(120,120,120));
STICKLINE(周K>=周D,周K,周D,1,0),COLOR6666FF;
STICKLINE(周K<周D,周K,周D,1,1),COLOR00FFFF;
STICKLINE(C>0,115,120,2,1),COLOR00FFFF;
STICKLINE(C>0,-15,-20,2,1),COLORFFFF88;
STICKLINE(周K>=周D,110,120,2,0),COLOR6666FF;
STICKLINE(月K>=月D,-10,-20,2,0),COLOR660099;
STICKLINE(C>0,48,52,2,1),COLORFFFFFF;
STICKLINE(周K>=周D AND 月K>=月D,42,58,2,1),COLORRED;
STICKLINE(月K<月D AND 周K>=周D,44,56,2,1),COLORFF00FF;
STICKLINE(月K>=月D AND 周K<周D,46,54,2,1),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=88,10,90,99,0),COLOR222255;
STICKLINE(CURRBARSCOUNT=88,100,90,99,0),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=92,95,'中間彩柱'),COLORFF0000;
DRAWTEXT(CURRBARSCOUNT=8,110,'周KD金叉'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=8,-10,'月KD交叉'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=98,20,'月死叉周死叉--全退--白色'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=98,40,'月金叉周死叉--減倉--綠色'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=98,60,'月死叉周金叉--反彈--粉色'),COLORFF00FF;
DRAWTEXT(CURRBARSCOUNT=98,80,'月金叉周金叉--持股--紅色'),COLORRED;
KDJ指標公式原始碼:
引數:N:=9; M1:=3; M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1);
D:SMA(K,M2,1);
J:3*K-2*D;
周K:=MA("KDJ.K#WEEK"(N,M1,M2) ,5),LINETHICK1,COLORRED;
周D:=MA("KDJ.D#WEEK"(N,M1,M2) ,5),LINETHICK1,COLOR33FF99;
周J:=MA("KDJ.J#WEEK"(N,M1,M2) ,5),LINETHICK1,COLORMAGENTA;
月K:MA("KDJ.K#MONTH"(N,M1,M2),5),LINETHICK1,COLORFF00FF;
月D:MA("KDJ.D#MONTH"(N,M1,M2),5),LINETHICK1,COLOR00FF00;
月J:=MA("KDJ.J#MONTH"(N,M1,M2),5),LINETHICK1,COLORFFFFFF;
DRAWBAND(月K,RGB(100,0,100),月D,RGB(120,120,120));
STICKLINE(周K>=周D,周K,周D,1,0),COLOR6666FF;
STICKLINE(周K<周D,周K,周D,1,1),COLOR00FFFF;
STICKLINE(C>0,115,120,2,1),COLOR00FFFF;
STICKLINE(C>0,-15,-20,2,1),COLORFFFF88;
STICKLINE(周K>=周D,110,120,2,0),COLOR6666FF;
STICKLINE(月K>=月D,-10,-20,2,0),COLOR660099;
STICKLINE(C>0,48,52,2,1),COLORFFFFFF;
STICKLINE(周K>=周D AND 月K>=月D,42,58,2,1),COLORRED;
STICKLINE(月K<月D AND 周K>=周D,44,56,2,1),COLORFF00FF;
STICKLINE(月K>=月D AND 周K<周D,46,54,2,1),COLOR00FF00;
STICKLINE(CURRBARSCOUNT=88,10,90,99,0),COLOR222255;
STICKLINE(CURRBARSCOUNT=88,100,90,99,0),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=92,95,'中間彩柱'),COLORFF0000;
DRAWTEXT(CURRBARSCOUNT=8,110,'周KD金叉'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=8,-10,'月KD交叉'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=98,20,'月死叉周死叉--全退--白色'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=98,40,'月金叉周死叉--減倉--綠色'),COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=98,60,'月死叉周金叉--反彈--粉色'),COLORFF00FF;
DRAWTEXT(CURRBARSCOUNT=98,80,'月金叉周金叉--持股--紅色'),COLORRED;