通达信公式远大指标MACD+KDJ副图
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2;
D:SMA(K,3,1),LINETHICK2;
J:3*K-2*D,LINETHICK2,COLORRED;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,21),COLORGREEN,NODRAW;
DEA :EMA(DIFF,9),COLORBLUE,NODRAW;
MACD:2*(DIFF-DEA),COLORRED,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(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.3,0),COLOR00AAFF;{黄s段}
STICKLINE(CDA,SH,MACDA,2.0,0),COLOR00BBFF;
STICKLINE(CDA,SH,MACDA,1.8,0),COLOR00CCFF;
STICKLINE(CDA,SH,MACDA,1.5,0),COLOR00DDFF;
STICKLINE(CDA,SH,MACDA,1.0,0),COLOR00EEFF;
STICKLINE(CDA,SH,MACDA,0.5,0),COLOR00FFFF;
STICKLINE(CDB,SH,MACDA,2.3,0),COLOR0000AA; {红色段}
STICKLINE(CDB,SH,MACDA,2.0,0),COLOR0011BB;
STICKLINE(CDB,SH,MACDA,1.8,0),COLOR0022CC;
STICKLINE(CDB,SH,MACDA,1.5,0),COLOR0033DD;
STICKLINE(CDB,SH,MACDA,1.0,0),COLOR0044EE;
STICKLINE(CDB,SH,MACDA,0.5,0),COLOR0055FF;
STICKLINE(CDC,SH,MACDA,2.3,0),COLORAA00BB;{向上粉红}
STICKLINE(CDC,SH,MACDA,2.0,0),COLORBB11BB;
STICKLINE(CDC,SH,MACDA,1.8,0),COLORCC22BB;
STICKLINE(CDC,SH,MACDA,1.5,0),COLORDD33BB;
STICKLINE(CDC,SH,MACDA,1.0,0),COLOREE44BB;
STICKLINE(CDC,SH,MACDA,0.5,0),COLORFF55BB;
STICKLINE(CDD,SH,MACDA,2.3,0),COLORFF7700;
STICKLINE(CDD,SH,MACDA,2.0,0),COLORFF8811;
STICKLINE(CDD,SH,MACDA,1.8,0),COLORFFAA22;
STICKLINE(CDD,SH,MACDA,1.5,0),COLORFFBB33;
STICKLINE(CDD,SH,MACDA,1.0,0),COLORFFDD44;
STICKLINE(CDD,SH,MACDA,0.5,0),COLORFFDD55;
DRAWTEXT(BARSTATUS=2,SH,' 0轴'),COLOR00AAAA;
100,COLORRED,DOTLINE;
0,COLORGREEN,DOTLINE;
110,COLORMAGENTA,DOTLINE;
-10,COLORLIGREEN,DOTLINE;
连长:BARSLASTCOUNT(MACD>REF(MACD,1)),NODRAW;
连短:BARSLASTCOUNT(MACD<REF(MACD,1)),NODRAW;
红柱面积:IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),NODRAW;
绿柱面积:IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),NODRAW;
红柱天:BARSLASTCOUNT(MACD>0),NODRAW;
绿柱天:BARSLASTCOUNT(MACD<0),NODRAW;
TJ:=MACD>0;
T:=MACD<0;
DRAWTEXT(BARSLAST(TJ)=1,MACDA*0.99,'1');
DRAWTEXT(BARSLAST(TJ)=3,MACDA*0.99,'3');
DRAWTEXT(BARSLAST(TJ)=5,MACDA*0.99,'5');
DRAWTEXT(BARSLAST(TJ)=8,MACDA*0.99,'8');
DRAWTEXT(BARSLAST(TJ)=13,MACDA*0.99,'13');
DRAWTEXT(BARSLAST(TJ)=21,MACDA*0.99,'21');
DRAWTEXT(BARSLAST(TJ)=34,MACDA*0.99,'34');
DRAWTEXT(BARSLAST(T)=1,MACDA*1.01,'1');
DRAWTEXT(BARSLAST(T)=3,MACDA*1.01,'3');
DRAWTEXT(BARSLAST(T)=5,MACDA*1.01,'5');
DRAWTEXT(BARSLAST(T)=8,MACDA*1.01,'8');
DRAWTEXT(BARSLAST(T)=13,MACDA*1.01,'13');
DRAWTEXT(BARSLAST(T)=21,MACDA*1.01,'21');
DRAWTEXT(BARSLAST(T)=34,MACDA*1.01,'34'); |