自用通达信MACD和KDJ (源码、有图)介绍
自用通达信MACD和KDJ (源码、有图)
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
CD : 2*(DIFF-DEA), COLORSTICK,COLORMAGENTA;
A:=IF(CROSS(0,DEA),1,0);
AA1:=IF(DIFF<0 AND CROSS(DIFF,DEA),1,0);
SS:=IF(A,SUM(AA1,0),0);
SSB:=HHV(SS,0);
SSS:=SUM(AA1,0);
二金:IF(SSS-SSB=2 AND SSS>REF(SSS,1),0.4,0),COLORMAGENTA;
STICKLINE(二金=DEA,DEA,DIFF,0,0),COLORMAGENTA;
AA:="MACD.DIF#WEEK";
BB:="MACD.DEA#WEEK";
AAA:="MACD.DIF#MONTH";
BBB:="MACD.DEA#MONTH";
周金:IF(CROSS(AA,BB),0.2,0),STICK,LINETHICK2,COLOR0099FF;
月金:IF(CROSS(AAA,BBB),0.2,0),STICK,LINETHICK2,COLOR0099FF;
DRAWTEXT(CROSS(AAA,BBB),0.2,'月'),COLOR0099FF;
DRAWTEXT(CROSS(AA,BB),0.2,'周'),COLOR0099FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
M底:IF(B1>0,-0.1,0),COLORRED,POINTDOT;
K底:IF(B2>0,-0.1,0),COLORFF00FF,POINTDOT;
R底:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;
M顶:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;
K顶:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;
R顶:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;
STICKLINE(B1>0,-0.1,0,2,0),COLORRED;
STICKLINE(B2>0,-0.1,0,2,0),COLORFF00FF;
STICKLINE(B3>0,-0.1,0,2,0),COLORYELLOW;
STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;
STICKLINE(D2>0,0.1,0,2,0),COLORFFCC66;
STICKLINE(D3>0,0.1,0,2,0),COLORWHITE;
自用KDJ
{N=2,120,20}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),COLORWHITE;
D:SMA(K,3,1),COLORYELLOW;
J:3*K-2*D,COLORMAGENTA;
TYP:=(HIGH+LOW+CLOSE)/3;
J值关注:IF(J<0,50,0),COLORRED,LINETHICK2;
零轴:0,LINETHICK1,COLORWHITE;
超买:100,LINETHICK1,COLORGREEN;
CCI14:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),COLORLIBLUE;
CCI14关注:IF(CCI14<-200,44,0),COLORWHITE,LINETHICK2;
BOLL:=MA(CLOSE,N);
UPPER:=BOLL+2*STD(CLOSE,N);
AA:="KDJ.K#WEEK";
BB:="KDJ.D#WEEK";
AAA:="KDJ.K#MONTH";
BBB:="KDJ.D#MONTH";
周金:IF(CROSS(AA,BB),25,0),STICK,LINETHICK2,COLORYELLOW;
月金:IF(CROSS(AAA,BBB),25,0),STICK,LINETHICK2,COLOR0099FF;
DRAWTEXT(CROSS(AAA,BBB),40,'月'),COLOR0099FF;
DRAWTEXT(CROSS(AA,BB),30,'周'),COLORYELLOW;
VAR1:=SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),0);
VAR2:=SUMBARS(VOL,CAPITAL);
VAR3:=IF(CLOSE>LLV(CLOSE,VAR2),1,-1);
VAR4:=IF(VAR1>LLV(VAR1,VAR2),1,-1);
VAR5:=VAR3*VAR4;
VAR6:=IF(VAR5=-1,1,0);
VAR7:="KD.K#WEEK"<20;
周K低:IF(VAR7 AND VAR6 AND CLOSE=LLV(CLOSE,5),20,0),STICK,LINETHICK2,COLORRED;
DRAWTEXT(VAR7 AND VAR6 AND CLOSE=LLV(CLOSE,5),80,'低'),COLORRED;
gd16095