以下是同花顺MACD与KD组合副图指标 源码

MACD与KD的组合,图形非常简单实用,让你轻松短线操作。

DIFF:=EMA(CLOSE,12) – EMA(CLOSE,26);
 DEA:=EMA(DIFF,9);
 MACD:=2*(DIFF-DEA/2);
 AH:=HHV(MACD,13*1);
 AL:=LLV(MACD,13*0.3);
 STICKLINE(MACD>0 ,MACD,0,1,0),COLOR0000AA,LINETHICK1;
 STICKLINE(MACD<0 ,MACD,0,1,0),COLOR008800,LINETHICK1;
趋势线:=EMA(MACD,34,1);
 PARTLINE(趋势线,趋势线>REF(趋势线,1),RGB(255,255,0),趋势线<REF(趋势线,1),RGB(0,80,255)),LINETHICK1;
 FILLRGN(趋势线,REF(趋势线,1),趋势线>REF(趋势线,1),RGB(255,255,0),趋势线<=REF(趋势线,1),RGB(0,88,255));
 K:=SMA(MACD,2,1);
 D:=SMA(K,2,1);
 J:SMA(D,2,1);
 STICKLINE(MACD>0,0.000001,0.000003,15,0),colorred;
 STICKLINE(MACD<0,0.000001,0.000003,15,0),colorgreen;
 PARTLINE(K,K>REF(K,1),RGB(255,0,0),K<REF(K,1),RGB(0,255,0)),LINETHICK1;
 PARTLINE(D,D>REF(D,1),RGB(255,0,0),D<REF(D,1),RGB(0,255,0)),LINETHICK1;
 PARTLINE(J,J>REF(J,1),RGB(255,0,0),J<REF(J,1),RGB(0,255,0)),LINETHICK2;
 STICKLINE(REF(MACD,1)<MACD,MACD,REF(MACD,1),7,0),coloryellow;
 STICKLINE(MACD=AH,AH,K,8,0),LINETHICK1,colorred;
 STICKLINE(REF(MACD,2)>MACD,MACD,REF(MACD,1),8,1),colorgreen;
 HSNP1:=CLOSE-REF(CLOSE,1);
 MA1:=MA((HIGH+LOW)/2,P1);
 MA2:=MA((HIGH+LOW)/2,P2);
 OSC:MA1-MA2,LINETHICK0;
 UPO:=IF(OSC>=0,OSC,DRAWNULL);
 UP: EMA(UPO,P2+P1/1.618),COLOR5A9A00;
 DNO:=IF(OSC<=0,OSC,DRAWNULL);
 DN: EMA(DNO,P2+P1/1.618),COLOR5A9A00;
 STICKLINE( OSC>=REF(OSC,1), 0, OSC, 1, 0),colorred;
 STICKLINE( OSC<=REF(OSC,1), 0, OSC, 1, 0),COLORBBDD00;
 HSNP2:=IF(CLOSE-REF(CLOSE,1)>=0,HSNP1,0);
 HSNP3:=REF(CLOSE,1)-CLOSE;
 HSNP4:=IF(CLOSE-REF(CLOSE,1)<=0,HSNP3,0);
 HSNP5:=SUM(HSNP2,90)/SUM(HSNP4,90);
 HSNP6:=100-100/(1+HSNP5);
 HSNP7:=EMA(HSNP6,21);
 HSNP8:=EMA(HSNP7,5);
 HSNP:=EMA(HSNP7,3);
 NP:=(HSNP7-HSNP);
 NL:=(HSNP-HSNP7);
 JJ :=(C*2+H+L)/4;
 SK := EMA(JJ,13) – EMA(JJ,21);
 SD := EMA(SK,3);
 SP := EMA(SK,10);
 A1:=EMA(CLOSE,7)-EMA(CLOSE,21);
 B1:=EMA((0.668*REF(A1,1)+0.333*A1),1);
 MA:IF(A1>=B1,A1,B1),LINETHICK1,Culor00ff00;
单线红买:IF(B1-A1,B1,A1),LINETHICK1,colorred;
 TT:=(2*CLOSE+OPEN+HIGH+LOW);
主导动能:TT/EMA(TT,4)-1,COLORSTICK;
 FF:=主导动能;
STICKLINE(FF>0,0,FF,3,0),COLOR33CFDD;
 STICKLINE(FF>0 AND FF>REF(FF,1),0,FF,3,0),COLOR0000CC;
 STICKLINE(FF<=0,0,FF,3,0),COLOR00CC00;
 STICKLINE(FF<=0 AND FF>REF(FF,1),0,FF,3,0),COLORFF9900;
做多主导:IFF(FF>0 AND FF>REF(FF,1),FF,0),NODRAW,COLOR0000CC;
获利回吐:IFF(FF>0 AND FF<=REF(FF,1),FF,0),NODRAW,COLOR33CFDD;
做空主导:IFF(FF<=0 AND FF<=REF(FF,1),FF,0),NODRAW,COLOR00CC00;
空头回补:IFF(FF<=0 AND FF>REF(FF,1),FF,0),NODRAW,COLORFF9900;

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