kdj結合macd二合一指標公式原始碼:
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K0:=SMA(RSV,3,1);
D0:=SMA(K0,3,1);
J0:=3*K0-2*D0;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORGREEN,NODRAW;
DEA:EMA(DIFF,9),COLORLIRED,NODRAW;
MACD:2*(DIFF-DEA),COLORMAGENTA,NODRAW;
{RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD; }
KX:=250;
KH:=HHV(K0,KX);
DH:=HHV(D0,KX);
JH:=HHV(J0,KX);
KL:=LLV(K0,KX);
DL:=LLV(D0,KX);
JL:=LLV(J0,KX);
HKMAX:=MAX(KH,MAX(DH,JH));
LKMIN:=MIN(KL,MIN(DL,JL));
KHLB:=(HKMAX+LKMIN)/2;
KHLC:=HKMAX-LKMIN;
MHF:=HHV(DIFF,KX);
MHD:=HHV(DEA,KX);
MHM:=HHV(MACD,KX);
MLF:=LLV(DIFF,KX);
MLD:=LLV(DEA,KX);
MLM:=LLV(MACD,KX);
HMAX:=MAX(MHF,MAX(MHD,MHM));
LMIN:=MIN(MLF,MIN(MLD,MLM));
FHLB:=(HMAX-LMIN)/100;
FHLC:=HMAX-LMIN;
SH:(0-FHLB)*(KHLC/FHLC)+KHLB,COLOR00AAAA;
{DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;
DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;
DRAWBAND(DIFFA,RGB(255,110,150),DEAA,RGB(100,255,150));}
DRAWTEXT(ISLASTBAR=1,SH,' 0 軸'),COLOR00AAAA;
K:K0,LINETHICK2,COLORFF6600;
D:D0,LINETHICK2,COLOR99FF00;
J:J0,LINETHICK2,COLORRED;
MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;
CDA:=MACD<REF(MACD,1) AND MACD>0;
CDB:=MACD>=REF(MACD,1) AND MACD>0;
CDC:=MACD>REF(MACD,1) AND MACD<0;
CDD:=MACD<=REF(MACD,1) AND MACD<0;
STICKLINE(CDA,SH,MACDA,1.8,0),COLOR0066FF;{黃色段}
STICKLINE(CDA,SH,MACDA,1.5,0),COLOR0077FF;
STICKLINE(CDA,SH,MACDA,1.2,0),COLOR0088FF;
STICKLINE(CDA,SH,MACDA,1.0,0),COLOR0099FF;
STICKLINE(CDA,SH,MACDA,0.8,0),COLOR00AAFF;
STICKLINE(CDA,SH,MACDA,0.5,0),COLOR00EEFF;
STICKLINE(CDB,SH,MACDA,1.8,0),COLOR0000AA; {紅色段}
STICKLINE(CDB,SH,MACDA,1.5,0),COLOR0011BB;
STICKLINE(CDB,SH,MACDA,1.2,0),COLOR0022CC;
STICKLINE(CDB,SH,MACDA,1.0,0),COLOR0033DD;
STICKLINE(CDB,SH,MACDA,0.8,0),COLOR0044EE;
STICKLINE(CDB,SH,MACDA,0.5,0),COLOR0055FF;
STICKLINE(CDC,SH,MACDA,1.8,0),COLORAA00BB;{向上粉紅}
STICKLINE(CDC,SH,MACDA,1.5,0),COLORBB11BB;
STICKLINE(CDC,SH,MACDA,1.2,0),COLORCC22BB;
STICKLINE(CDC,SH,MACDA,1.0,0),COLORDD33BB;
STICKLINE(CDC,SH,MACDA,0.8,0),COLOREE44BB;
STICKLINE(CDC,SH,MACDA,0.5,0),COLORFF55BB;
STICKLINE(CDD,SH,MACDA,1.8,0),COLOR007700;{青色}
STICKLINE(CDD,SH,MACDA,1.5,0),COLOR008811;
STICKLINE(CDD,SH,MACDA,1.2,0),COLOR00AA22;
STICKLINE(CDD,SH,MACDA,1.0,0),COLOR00BB33;
STICKLINE(CDD,SH,MACDA,0.8,0),COLOR00DD44;
STICKLINE(CDD,SH,MACDA,0.5,0),COLOR00DD55;
{頂底訊號}
VAR51:=(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34))*100;
VAR52:=SMA(VAR51,4,1);
VAR53:=SMA(VAR52,6,1);
VAR54:=VOL/CAPITAL*34;
VAR55:=REF(VAR54,1);
STICKLINE(VAR53<7 AND VAR52<11,-3,0,3,0),LINETHICK2,COLORYELLOW;
STICKLINE(VAR53>89.5 AND VAR52>91,100,97,3,0),LINETHICK1,COLORFF8888;
STICKLINE(VAR53>88.5 AND VAR52>94.6,100,95,5,0),COLORRED;
kdj結合macd二合一指標公式原始碼:
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K0:=SMA(RSV,3,1);
D0:=SMA(K0,3,1);
J0:=3*K0-2*D0;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORGREEN,NODRAW;
DEA:EMA(DIFF,9),COLORLIRED,NODRAW;
MACD:2*(DIFF-DEA),COLORMAGENTA,NODRAW;
{RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD; }
KX:=250;
KH:=HHV(K0,KX);
DH:=HHV(D0,KX);
JH:=HHV(J0,KX);
KL:=LLV(K0,KX);
DL:=LLV(D0,KX);
JL:=LLV(J0,KX);
HKMAX:=MAX(KH,MAX(DH,JH));
LKMIN:=MIN(KL,MIN(DL,JL));
KHLB:=(HKMAX+LKMIN)/2;
KHLC:=HKMAX-LKMIN;
MHF:=HHV(DIFF,KX);
MHD:=HHV(DEA,KX);
MHM:=HHV(MACD,KX);
MLF:=LLV(DIFF,KX);
MLD:=LLV(DEA,KX);
MLM:=LLV(MACD,KX);
HMAX:=MAX(MHF,MAX(MHD,MHM));
LMIN:=MIN(MLF,MIN(MLD,MLM));
FHLB:=(HMAX-LMIN)/100;
FHLC:=HMAX-LMIN;
SH:(0-FHLB)*(KHLC/FHLC)+KHLB,COLOR00AAAA;
{DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;
DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;
DRAWBAND(DIFFA,RGB(255,110,150),DEAA,RGB(100,255,150));}
DRAWTEXT(ISLASTBAR=1,SH,' 0 軸'),COLOR00AAAA;
K:K0,LINETHICK2,COLORFF6600;
D:D0,LINETHICK2,COLOR99FF00;
J:J0,LINETHICK2,COLORRED;
MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;
CDA:=MACD<REF(MACD,1) AND MACD>0;
CDB:=MACD>=REF(MACD,1) AND MACD>0;
CDC:=MACD>REF(MACD,1) AND MACD<0;
CDD:=MACD<=REF(MACD,1) AND MACD<0;
STICKLINE(CDA,SH,MACDA,1.8,0),COLOR0066FF;{黃色段}
STICKLINE(CDA,SH,MACDA,1.5,0),COLOR0077FF;
STICKLINE(CDA,SH,MACDA,1.2,0),COLOR0088FF;
STICKLINE(CDA,SH,MACDA,1.0,0),COLOR0099FF;
STICKLINE(CDA,SH,MACDA,0.8,0),COLOR00AAFF;
STICKLINE(CDA,SH,MACDA,0.5,0),COLOR00EEFF;
STICKLINE(CDB,SH,MACDA,1.8,0),COLOR0000AA; {紅色段}
STICKLINE(CDB,SH,MACDA,1.5,0),COLOR0011BB;
STICKLINE(CDB,SH,MACDA,1.2,0),COLOR0022CC;
STICKLINE(CDB,SH,MACDA,1.0,0),COLOR0033DD;
STICKLINE(CDB,SH,MACDA,0.8,0),COLOR0044EE;
STICKLINE(CDB,SH,MACDA,0.5,0),COLOR0055FF;
STICKLINE(CDC,SH,MACDA,1.8,0),COLORAA00BB;{向上粉紅}
STICKLINE(CDC,SH,MACDA,1.5,0),COLORBB11BB;
STICKLINE(CDC,SH,MACDA,1.2,0),COLORCC22BB;
STICKLINE(CDC,SH,MACDA,1.0,0),COLORDD33BB;
STICKLINE(CDC,SH,MACDA,0.8,0),COLOREE44BB;
STICKLINE(CDC,SH,MACDA,0.5,0),COLORFF55BB;
STICKLINE(CDD,SH,MACDA,1.8,0),COLOR007700;{青色}
STICKLINE(CDD,SH,MACDA,1.5,0),COLOR008811;
STICKLINE(CDD,SH,MACDA,1.2,0),COLOR00AA22;
STICKLINE(CDD,SH,MACDA,1.0,0),COLOR00BB33;
STICKLINE(CDD,SH,MACDA,0.8,0),COLOR00DD44;
STICKLINE(CDD,SH,MACDA,0.5,0),COLOR00DD55;
{頂底訊號}
VAR51:=(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34))*100;
VAR52:=SMA(VAR51,4,1);
VAR53:=SMA(VAR52,6,1);
VAR54:=VOL/CAPITAL*34;
VAR55:=REF(VAR54,1);
STICKLINE(VAR53<7 AND VAR52<11,-3,0,3,0),LINETHICK2,COLORYELLOW;
STICKLINE(VAR53>89.5 AND VAR52>91,100,97,3,0),LINETHICK1,COLORFF8888;
STICKLINE(VAR53>88.5 AND VAR52>94.6,100,95,5,0),COLORRED;