通达信【MACD叠加KDJ】套装指标 源码
注意:源码中使用引用数据,要使用电脑安装,手机不支持引用数据的安装。
信号较多,做一个“MACD与KDJ金叉共振的选股信号”,以下举例:
图片
图片
图片
1、叠加主图指标:
{微信公众号:尊重市场}
持股线:EMA(C,13),COLORMAGENTA;
尊重市场:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(尊重市场,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MAABC:=2*(DIFF-DEA);
尊重市场1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
ABC1:=SMA(尊重市场1,3,1);
ABC2:=SMA(ABC1,3,1);
ABC3:=3*ABC1-2*ABC2;
ABC4:=250;
ABC5:=HHV(K,ABC4);
ABC6:=HHV(D,ABC4);
ABC7:=HHV(J,ABC4);
ABC8:=LLV(K,ABC4);
ABC9:=LLV(D,ABC4);
ABC10:=LLV(J,ABC4);
微信公众号:=MAX(ABC5,MAX(ABC6,ABC7));
股民指标:=MIN(ABC8,MIN(ABC9,ABC10));
ABC5LB:=(微信公众号+股民指标)/2;
ABC5LC:=微信公众号-股民指标;
CBA1:=HHV(DIFF,ABC4);
CBA2:=HHV(DEA,ABC4);
CBA3:=HHV(MAABC,ABC4);
BCF:=LLV(DIFF,ABC4);
BABC:=LLV(DEA,ABC4);
BCM:=LLV(MAABC,ABC4);
HMAX:=MAX(CBA1,MAX(CBA2,CBA3));
LMIN:=MIN(BCF,MIN(BABC,BCM));
BCAB:=(HMAX-LMIN)/100;
BCAC:=HMAX-LMIN;
SH:=(0-BCAB)*(ABC5LC/BCAC)+ABC5LB;
DIFFA:=(DIFF-BCAB)*(ABC5LC/BCAC)+ABC5LB;
DEAA:=(DEA-BCAB)*(ABC5LC/BCAC)+ABC5LB;
MAABCA:=(MAABC-BCAB)*(ABC5LC/BCAC)+ABC5LB;
ABCA:=MAABC<REF(MAABC,1) AND MAABC>0;
ABCB:=MAABC>=REF(MAABC,1) AND MAABC>0;
ABCC:=MAABC>REF(MAABC,1) AND MAABC<0;
CABC2:=MAABC<=REF(MAABC,1) AND MAABC<0;
{微信公众号:尊重市场}
ABC1K:=SMA(尊重市场,3,1),COLORWHITE,LINETHICK2;
ABC2D:=SMA(ABC1K,3,1),COLORYELLOW,LINETHICK2;
ABC3J:=3*ABC1K-2*ABC2D,COLORMAGENTA,LINETHICK2;
A:=CROSS(DIFF,DEA) AND CROSS(ABC1K,ABC2D) AND CROSS(ABC3J,ABC2D);
DRAWICON(A,C,9);
DRAWTEXT(A,C,' MK金叉共振'),COLORYELLOW;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWICON(低位金叉,C,25);
DRAWTEXT(低位金叉,C,' M低金'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWICON(二次金叉,L*0.98,41);
DRAWTEXT(二次金叉,L*0.98,' M二金'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));{微信公众号:尊重市场}
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
DRAWICON((B1>0),L,41);
DRAWTEXT((B1>0),L,' M底'),COLORRED;
DRAWICON((D1>0),H,37);
DRAWTEXT((D1>0),H,' M顶'),COLORGREEN;
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));
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));
DRAWICON((B2>0),L,41);
DRAWTEXT((B2>0),L*0.98,' K底'),COLORWHITE;
DRAWICON((D2>0),H,37);
DRAWTEXT((D2>0),H,' K顶'),COLORGREEN;
{微信公众号:尊重市场}
N:=1;
日K:=KDJ.K;
日D:=KDJ.D;
日J:=KDJ.J;
周K:=KDJ.K#WEEK,NODRAW;
周D:=KDJ.D#WEEK,NODRAW;
周J:=KDJ.J#WEEK,NODRAW;
日金叉:=CROSS(日K,日D) AND (日D<40 OR 日D>60);
周金叉:=CROSS(周K,周D) AND (周D<40 OR 周D>60);
{微信公众号:尊重市场}
共振:=(周金叉 AND 日金叉);
DRAWTEXT((周金叉 AND 日金叉),L,' K日周共振'),COLORYELLOW;
DRAWICON((周金叉 AND 日金叉),L,5);
2、叠加副图指标:
{微信公众号:尊重市场}
尊重市场:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(尊重市场,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MAABC:=2*(DIFF-DEA);
尊重市场1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
ABC1:=SMA(尊重市场1,3,1);
ABC2:=SMA(ABC1,3,1);
ABC3:=3*ABC1-2*ABC2;
ABC4:=250;
ABC5:=HHV(K,ABC4);
ABC6:=HHV(D,ABC4);
ABC7:=HHV(J,ABC4);
ABC8:=LLV(K,ABC4);
ABC9:=LLV(D,ABC4);
ABC10:=LLV(J,ABC4);
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。