众所周知,MACD是一个中长趋势类指标,而KDJ是一个短线波动指标,这两个指标,也是大部分投资都使用最频繁的指标,再加上一个成交量,一个主图,就是一个完整的交易系统。一直以来,想做一个MACD叠加KDJ,在飞狐里,非常容易实现,在通达信里,却始终写不出那样的效果,总是不基满意。前几天,无意中看到了一个大智慧用的MACD叠加KDJ,感觉还不错,所以修改了下源码,支掉一些背离,金叉和一些个人觉得不必要的提示,做了一个通达信的,感觉效果还可以,送给大家,只为节约一个副图版面。之所以要去掉一些提示,主要是想让大家,相信自己的眼睛,比什么提示都强。同时加入了一点自己的顶部提示,供大家参考。
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2,COLORWHITE;
D:SMA(K,3,1),LINETHICK2,COLORYELLOW;
J:3*K-2*D,LINETHICK2,COLORRED;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,COLORGREEN,LINETHICK0;
DEA :EMA(DIFF,9),LINETHICK2,COLORBLUE,LINETHICK0;
MACD:2*(DIFF-DEA),LINETHICK2,COLORRED,LINETHICK0;
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(K,KX);
DH:=HHV(D,KX);
JH:=HHV(J,KX);
KL:=LLV(K,KX);
DL:=LLV(D,KX);
JL:=LLV(J,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;
DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;
DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;
DRAWBAND(DIFFA,RGB(255,11,11),DEAA,RGB(10,255,10));
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,2.8,0),COLOR00AAFF;{黄s段}
STICKLINE(CDA,SH,MACDA,2.7,0),COLOR00BBFF;
STICKLINE(CDA,SH,MACDA,2.4,0),COLOR00CCFF;
STICKLINE(CDA,SH,MACDA,2.3,0),COLOR00DDFF;
STICKLINE(CDA,SH,MACDA,2.2,0),COLOR00EEFF;
STICKLINE(CDA,SH,MACDA,1.1,0),COLOR00FFFF;
STICKLINE(CDB,SH,MACDA,2.8,0),COLOR0000AA; {红色段}
STICKLINE(CDB,SH,MACDA,2.7,0),COLOR0011BB;
STICKLINE(CDB,SH,MACDA,2.4,0),COLOR0022CC;
STICKLINE(CDB,SH,MACDA,2.3,0),COLOR0033DD;
STICKLINE(CDB,SH,MACDA,2.2,0),COLOR0044EE;
STICKLINE(CDB,SH,MACDA,1.1,0),COLOR0055FF;
STICKLINE(CDC,SH,MACDA,2.8,0),COLORAA00BB;{向上粉红}
STICKLINE(CDC,SH,MACDA,2.7,0),COLORBB11BB;
STICKLINE(CDC,SH,MACDA,2.4,0),COLORCC22BB;
STICKLINE(CDC,SH,MACDA,2.3,0),COLORDD33BB;
STICKLINE(CDC,SH,MACDA,2.2,0),COLOREE44BB;
STICKLINE(CDC,SH,MACDA,1.1,0),COLORFF55BB;
STICKLINE(CDD,SH,MACDA,2.8,0),COLORFF7700;
STICKLINE(CDD,SH,MACDA,2.7,0),COLORFF8811;
STICKLINE(CDD,SH,MACDA,2.4,0),COLORFFAA22;
STICKLINE(CDD,SH,MACDA,2.3,0),COLORFFBB33;
STICKLINE(CDD,SH,MACDA,2.2,0),COLORFFDD44;
STICKLINE(CDD,SH,MACDA,1.1,0),COLORFFDD55;
DRAWTEXT(BARSTATUS=2,SH,' 0轴'),COLOR00AAAA;
VAR51:=(CLOSE-LLV(LOW,32))/(HHV(HIGH,32)-LLV(LOW,32))*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,-5,0,3,0),LINETHICK2 ,COLORYELLOW ;
STICKLINE(VAR53>89.5 AND VAR52>91,100,95,3,0) ,LINETHICK1 ,COLORFFB210 ;
STICKLINE(VAR53>88.5 AND VAR52>94.6,100,96,3,0),,COLORRED ; |