当前位置:→ 公式网 > 通达信公式 > 正文 ℃ 公式解密、改选股等业务 联系点击查看详情...
以下是KDJ衍生MACD(无源码的请下载附件导入)
C/C++ www.gszb.com 股票公式指标网提供 Code复制内容到剪贴板
- {公式名称:KDJ_MACD };
- {原创及版权:属于JIPGEMLING.见凌见};
- {参数设置:SHORT(2,300,12); LONG(2,300,26); MID(2,100,9)};
- {参数设置:M1(2,100,4); M2(2,100,3); NXCCI(6,60,9)};
- {参数设置:YS(1,4,1) ;1=MACD由RSV衍生,2=由K衍生;3=由D衍生;4=由J衍生};
- {坐标线位置: -50;-20;20;50;80;100 };
- {额外Y轴分界 值1=0 };
- {系统设置:多日线=10日}
- {TDX版,中高分辨率屏幕};
- {特色参数; 可作分时线的技术指标};
- T:=PERIOD;
- SJ:=T>1;
- SHORT:=IF(SJ,SHORT,18);
- LONG:=IF(SJ,LONG,38);
- MID:=IF(SJ,MID,SQRT(SHORT*LONG)/2);
- NXCCI:=9;
- {经原点校正之KDJ,可用于抄新股};
- BG:=BARSCOUNT(CLOSE);
- LL:=LLV(L,SHORT);
- HH:=HHV(H,SHORT);
- CC:=CLOSE;
- RSV:=(CC-LL)/(1.001*HH-LL)*100;
- RSV_JGL:=IF(BG>0,RSV,50);
- KK:SMA(RSV_JGL,M1,1);
- DD:SMA(KK,M2,1);
- JJ:2.7*KK-1.7*DD;
- {附加显示};
- TS:=(KK>REF(KK,1) OR (DD>REF(DD,1)))AND (C>(H+L)/2);
- FH:=JJ>REF(JJ,1)OR TS;
- FF:=NOT(FH);
- RF:=REF(JJ,1);ZJ:=ABS(JJ-RF);
- STICKLINE(FH,JJ,RF,4,0),COLOR1389DE;
- STICKLINE(FH AND ZJ<4,JJ,RF-3,4,0),COLOR1389DE;
- STICKLINE(FH,JJ,RF,3.4,0),COLOR1399DD;
- STICKLINE(FH,JJ,RF,2,0),COLOR13AADD;
- STICKLINE(FH,JJ,RF,0.7,0),COLOR13BBDD;
- STICKLINE(FH AND ZJ<4,JJ,RF-3,3.4,0),COLOR1399DD;
- STICKLINE(FH AND ZJ<4,JJ,RF-3,2,0),COLOR13AADD;
- STICKLINE(FH AND ZJ<4,JJ,RF-3,0.7,0),COLOR13BBDD;
- STICKLINE(FH AND ZJ<4,JJ+1,RF-4,0.0,0),COLOR13DDDD;
- STICKLINE(FF,JJ,RF,4,0),COLOR139813;
- STICKLINE(FF AND ZJ<4,JJ-3,RF,4,0),COLOR139813;
- STICKLINE(FF,JJ,RF,3,0),COLOR33AA33;
- STICKLINE(FF,JJ,RF,2,0),COLOR33CC33;
- STICKLINE(FF,JJ,RF,0.8,0),COLOR33E833;
- STICKLINE(FF AND ZJ<4,JJ-3,RF,3,0),COLOR33AA33;
- STICKLINE(FF AND ZJ<4,JJ-3,RF,2,0),COLOR33CC33;
- STICKLINE(FF AND ZJ<4,JJ-3,RF,0.8,0),COLOR33E833;
- STICKLINE(FF AND ZJ<4,JJ-5,RF+1,0.0,0),COLOR33FF33;
- SGG:=T>6 OR (T<=5 AND C>=1.099*REF(C,1)OR(T=6 AND C>=1.15*REF(C,1)));
- 送果果:DRAWICON(IF(SGG,FH,0),(3*JJ+RF)/4,17);{17号图标};
- {由RSV或JJ 衍生 XD_MACD};
- DIF_XD:1.7*(EMA(IF(YS=1,RSV_JGL,IF(YS=2,KK,IF(YS=3,DD,JJ))),LONG)-50),COLORABCDEF;
- DEA_XD:EMA(DIF_XD,MID),COLORGREEN;
- MACD_XD:2*(DIF_XD-DEA_XD),COLORCYAN,COLORSTICK;
- 转强:IF(DIF_XD>REF(DIF_XD,1)OR FH,DIF_XD,DRAWNULL),COLORRED,LINETHICK1;
- {附加:NX_CCI显示};
- BS:=NXCCI;
- ZQ:=IF(T=5,20*BS,IF(T=6,4*BS,IF(T=7,BS,IF(T=9,2*BS,
- IF(T=10,BS/2,DRAWNULL)))));
- CHL:=(C+H+L)/3;
- NXL:=CHL-MA(CHL,ZQ);
- NX_CCI:NXL/(0.15*AVEDEV(CHL,ZQ))-30,COLOR338933,LINETHICK1;
- STICKLINE(NXL<0 AND ZQ,-30.5,-31,5,0),COLORFF8933;
- STICKLINE(NXL>=0 AND ZQ,-29.5,-30,5,0),COLOR1389FE;
- SS:DRAWTEXT(CROSS(-30,NX_CCI) AND ZQ,-36,'X'),COLORGREEN;
- WW:DRAWTEXT(CROSS(NX_CCI,-30) AND ZQ,-25,'N'),COLORRED;
- {以下推2个空格,可以减少莫名奇妙退出};