以下是通达信三周期KDJ副图指标公式源码

DIFF:EMA(CLOSE,10)-EMA(CLOSE,26);
 DEA:EMA(DIFF,9);
 MACD:2*(DIFF-DEA),NODRAW;
连续走强:EVERY(MACD>REF(MACD,1) AND MACD>0,2),NODRAW;
强势回调:EVERY(MACD<REF(MACD,1) AND MACD>0,2),NODRAW;
连续走弱:EVERY(MACD<REF(MACD,1) AND MACD<0,2),NODRAW;
连续反弹:EVERY(MACD>REF(MACD,1) AND MACD<0,2),NODRAW;
 TDXSTEP198:STICKLINE(连续反弹,MACD,MACD+0.1,1,0),COLORRED;
 TDXSTEP199:DRAWTEXT(连续反弹,MACD+0.15,55),COLORRED;
 TDXSTEP200:STICKLINE(MACD>=0,MACD,0,4,1),COLORF00FF0;
 TDXSTEP201:STICKLINE(MACD<0,MACD,0,4,1),COLORWHITE;
 TDXSTEP202:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,3,0),COLOR00AAFF;
 TDXSTEP203:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2.3,0),COLOR00BBFF;
 TDXSTEP204:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,1.2,0),COLOR00CCFF;
 TDXSTEP205:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,1.65,0),COLOR00DDFF;
 TDXSTEP206:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLOR00EEFF;
 TDXSTEP207:STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,0.55,0),COLORYELLOW;
 TDXSTEP208:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,3,0),COLOR0000AA;
 TDXSTEP209:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2.3,0),COLOR0011BB;
 TDXSTEP210:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,1.2,0),COLOR0022CC;
 TDXSTEP211:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,1.65,0),COLOR0033DD;
 TDXSTEP212:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLOR0044EE;
 TDXSTEP213:STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,0.55,0),COLOR0055FF;
 TDXSTEP214:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,3,0),COLORAA00BB;
 TDXSTEP215:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2.3,0),COLORBB11BB;
 TDXSTEP216:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.2,0),COLORCC22BB;
 TDXSTEP217:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.65,0),COLORDD33BB;
 TDXSTEP218:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLOREE44BB;
 TDXSTEP219:STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0.55,0),COLORFF55BB;
 TDXSTEP220:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,3,0),COLORFFAA00;
 TDXSTEP221:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2.3,0),COLORFFBB11;
 TDXSTEP222:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.2,0),COLORFFCC22;
 TDXSTEP223:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.65,0),COLORFFDD33;
 TDXSTEP224:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLORFFEE44;
 TDXSTEP225:STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,0.55,0),COLORFFFF55;
 TDXSTEP226:IF(DIFF<0,DIFF,0),COLORRED,LINETHICK2;
 TDXSTEP227:IF(DIFF<0,0,DIFF),COLORYELLOW,LINETHICK2;
 TDXSTEP228:IF(DIFF<DEA,DIFF,DEA),COLORGREEN;
 TDXSTEP229:IF(DIFF>DEA,DEA,DEA),COLORBLUE,LINETHICK2;
买点出击:=CROSS(DIFF,DEA) AND DIFF<(-0.1);
 TDXSTEP230:STICKLINE(买点出击,0,(-0.1),3,0),COLORYELLOW;
 TDXSTEP231:DRAWTEXT(买点出击,(-0.1),56),COLORYELLOW;
 JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次出击:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
 TDXSTEP232:STICKLINE(二次出击,0,(-0.1),2,0),COLORMAGENTA;
 TDXSTEP233:DRAWICON(二次出击,DEA*1.04,13);
 TDXSTEP234:DRAWTEXT(二次出击,(-0.18),57),COLORMAGENTA;
 AA1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
背离:=REF(CLOSE,AA1+1)>CLOSE AND DIFF>REF(DIFF,AA1+1) AND CROSS(DIFF,DEA);
 TDXSTEP235:STICKLINE(底背离,0,0.15,2,0),COLORMAGENTA;
 TDXSTEP236:DRAWTEXT(底背离,DEA,58),COLORRED;
 AA2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,AA2+1)<CLOSE AND REF(DIFF,AA2+1)>DIFF AND CROSS(DEA,DIFF);
 TDXSTEP237:DRAWTEXT(顶背离,DEA,59),COLORGREEN;
 A1:=DIFF<0 AND DEA<0;
 A2:=A1>REF(A1,1);
 A3:=BARSLAST(A2);
 A4:=COUNT(DEA>0 AND DIFF>0,A3)=0;
 A5:=CROSS(DIFF,DEA);
 A6:=BARSLAST(A5);
 A7:=REF(A6,A6+1)+A6;
 A8:=(DIFF+DEA)/2;
 A9:=(HIGH+LOW)/2;
 A10:=A5 AND A7<A3 AND A4 AND A8>REF(A8,A7) AND A9<REF(A9,A7) AND MACD>0;
 TDXSTEP238:DRAWTEXT(A10,DIFF*0.95,60),COLORYELLOW;
 AA3:=KD.K#WEEK(9,3,3);
 AA4:=KD.D#WEEK(9,3,3);
 TDXSTEP239:DRAWBAND(AA3/100,RGB(250,0,250),AA4/100,RGB(0,250,250));
金叉:CROSS(AA3,AA4)*0.2;
月KDK:=KD.K#MONTH(4,3,3);
月KDD:=KD.D#MONTH(4,3,3);
月金叉:CROSS(月KDK,月KDD)*0.4,COLORWHITE,LINETHICK2;
 TDXSTEP240:DRAWBAND(月KDK/50,RGB(250,200,0),月KDD/50,RGB(80,150,250));

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。