通达信杂交版KDJ指标公式
通达信杂交版KDJ指标公式:
N:=9;M1:=3;M2:=3;
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,LINETHICK1;
IF(J<0,J,DRAWNULL),COLORGREEN,LINETHICK2;
IF(K>90,K,DRAWNULL),COLOR0000FF,LINETHICK2;
IF(D>85,D,DRAWNULL),COLORFFFF11,LINETHICK2;
DRAWICON(K>80 AND D>80 AND CROSS(D,K),95,2);
OBV:=K;
P:=12;
A1:=REF(OBV,P)=HHV(OBV,2*P+1);
B1:=FILTER(A1,P);
C1:=BACKSET(B1,P+1);
D1:=FILTER(C1,P);{高点1}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1); S11:=R11>REF(R11,1);
DRAWLINE(D1,OBV,S11,OBV,1),COLORLIRED,LINETHICK1;
A2:=REF(OBV,P)=LLV(OBV,2*P+1);
B2:=FILTER(A2,P);
C2:=BACKSET(B2,P+1);
D2:=FILTER(C2,P);{低点1}
T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1); U11:=T11>REF(T11,1);
DRAWLINE(D2,OBV,U11,OBV,1),COLORLIGREEN,LINETHICK1;
Q1:=INTPART(3*8/18);
A12:=REF(OBV,Q1)=HHV(OBV,2*Q1+1);
B12:=FILTER(A12,Q1);
C12:=BACKSET(B12,Q1+1);
D12:=FILTER(C12,Q1);{高点2}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1); S112:=R112>REF(R112,1);
DRAWLINE(S11,OBV,S112,OBV,1),COLORRED,LINETHICK1;
Q2:=INTPART(3*8/18);
A22:=REF(OBV,Q2)=LLV(OBV,2*Q2+1);
B22:=FILTER(A22,Q2);
C22:=BACKSET(B22,Q2+1);
D22:=FILTER(C22,Q2);{低点2}
T112:=BACKSET(ISLASTBAR,BARSLAST(D22)+1); U112:=T112>REF(T112,1);
DRAWLINE(U11,OBV,U112,OBV,1),COLORGREEN,LINETHICK1;
DRAWICON(D2,OBV,1);
DRAWICON(D1,OBV,2);
压力:REF(OBV,BARSLAST(D1)),COLORFF00FF,NODRAW;
支撑:REF(OBV,BARSLAST(D2)),COLOR00FF00,NODRAW;
向上:CROSS(OBV,压力*1.01),NODRAW;
相对能量:(OBV-支撑)/(压力-支撑)*100,COLORYELLOW,NODRAW;
STICKLINE(C>0,支撑,支撑,1,0),COLORGREEN;
STICKLINE(C>0,压力,压力,1,0),COLORRED;
DRAWTEXT(CROSS(OBV,压力*1.01),压力,'压力线'),COLORRED;
DRAWTEXT(CROSS(支撑*0.99,OBV),支撑,'支撑线'),COLORGREEN;
RSVQ:=(CLOSE-LLV(LOW,INTPART(N*4.4)))/(HHV(HIGH,INTPART(N*4.4))-LLV(LOW,INTPART(N*4.4)))*100;
KQ:SMA(RSVQ,INTPART(M1*4.4),4),LINETHICK1,COLOR006FDD,NODRAW;
DQ:SMA(KQ,INTPART(M2*4.4),4),LINETHICK1,COLOR009F00,NODRAW;
JQ:3*KQ-2*DQ,LINETHICK,COLORABAB56;
RSVE:=(CLOSE-LLV(LOW,14))/(HHV(HIGH,14)-LLV(LOW,14))*100;
K0:=SMA(RSV,3,1);
D0:=SMA(K0,3,1);
JE:=3*K0-2*D0;
STICKLINE(KQ>=DQ,KQ,DQ,0.5,0),COLOR006FDD;
STICKLINE(KQ<DQ,KQ,DQ,0.3,0),COLOR009F00;
STICKLINE(KQ>DQ,KQ,DQ,0.3,0),COLOR0000EF;
STICKLINE(KQ<=DQ,KQ,DQ,0.3,0),COLOR33AA33;
STICKLINE(J>REF(J,1),HHV(J,3),LLV(J,3),0,0),COLOR00AAFF;
STICKLINE(J>REF(J,1),J,REF(J,1),0.5,0),COLOR0044FF;
STICKLINE(J>REF(J,1),J,REF(J,1),0.3,0),COLOR0088FF;
STICKLINE(J>REF(J,1),J,REF(J,1),0,0),COLOR00AAFF;
STICKLINE(J<REF(J,1),HHV(J,3),LLV(J,3),0,0),COLORFFAA00;
STICKLINE(J<REF(J,1),J,REF(J,1),0.5,0),COLORFF4400;
STICKLINE(J<REF(J,1),J,REF(J,1),0.3,0),COLORFF8800;
STICKLINE(J<REF(J,1),J,REF(J,1),0,0),COLORFFAA00;
VAR1:=C-REF(C,1);
VAR2:=100*EMA(EMA(VAR1,6),6)/EMA(EMA(ABS(VAR1),6),6);
MA5:=EMA(C,5);
MA13:=EMA(C,13);
UP:=DRAWLINE(L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS(MA13,MA5))+1),H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS
(MA5,MA13))+1),0),COLOR0000FF;
DOWN:=DRAWLINE(H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS
(MA5,MA13))+1),L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS
(MA13,MA5))+1),0),COLOR00FF00;
BT:(LLV(VAR2,2)=LLV(VAR2,7) AND COUNT(VAR2<0,2) AND CROSS(VAR2,MA(VAR2,2))) AND
REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1);
STICKLINE(BT,0,3,2,0),COLOR0000CC;
DRAWTEXT(BT,-3,'短牛'),COLOR0000FF;
TJ1:=REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1) AND C<HHV(H,21)*0.82;
STICKLINE(TJ1,0,2,2,0),COLORFF00FF;
DRAWTEXT(TJ1,-5,'中牛'),COLORFF00FF;
HR:=HHV(HIGH,55);
HRY:=LLV(LOW,55);
HRY11:=HR*HRY;
HRY33:=SQRT(HRY11);
TJ2:=REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1) AND C<HRY33;
STICKLINE(TJ2,0,2,4,0),COLORRED;
DRAWTEXT(TJ2,6,'大牛'),COLOR00FFFF;
ST:=REF(UP,1)>REF(UP,2) AND DOWN<REF(UP,1);
STICKLINE(ST,100,102,2,0),COLOR00FF00;
DRAWTEXT(ST,106,'卖'),COLOR00FF00;
N1:=6;
N2:=12;
N3:=24;
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;
RSI3:=SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100;
周RSI1:=MA("RSI.RSI1#WEEK"(N1,N2,N3) ,5),LINETHICK3,COLORYELLOW;
周RSI2:=MA("RSI.RSI2#WEEK"(N1,N2,N3) ,5),LINETHICK3,COLORFF00FF;
周RSI3:=MA("RSI.RSI3#WEEK"(N1,N2,N3) ,5),LINETHICK3,COLORGREEN;
周金▲:DRAWTEXT(CROSS("RSI.RSI1#WEEK"(N1,N2,N3),"RSI.RSI2#WEEK"(N1,N2,N3)) ,10,'▲周金'),COLORRED;
周死:DRAWTEXT(CROSS("RSI.RSI2#WEEK"(N1,N2,N3),"RSI.RSI1#WEEK"(N1,N2,N3)) ,100,'周死'),COLORGREEN;
通达信杂交版KDJ指标公式实例图解:
通达信杂交版KDJ指标公式