同花顺MACD和KD划线副图指标 源码

本指标由MACD&KDJ金叉共振指标改编,隐去了有关线段,看的更直观些。

//macd
 DIF:(EMA(CLOSE,12)-EMA(CLOSE,26))*100,colorwhite;
 DEA:EMA(DIF,9),coloryellow,LINETHICK1;
 MACD:(DIF-DEA)*2,COLORSTICK;
 STICKLINE(MACD>0,0,MACD,2,0),colorred;
 STICKLINE(MACD<0,0,MACD,2,0),colorgreen;
 STICKLINE(MACD>REF(MACD,1) AND MACD<0 ,0,MACD,2,0),colorff00ff;
 STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0),colorliblue;
上翘:IF(DIF>REF(DIF,1),DIF,DRAWNULL),colorred,LINETHICK1;
下拐:IF(DIF<REF(DIF,1),DIF,DRAWNULL),colorliblue,LINETHICK1;
 //DRAWICON(CROSS(DIF,DEA),DIF,1);
 //DRAWICON(CROSS(DEA,DIF),DEA,2);
 DRAWICON(CROSS(DIF,DEA),DEA,'buy');
 DRAWICON(CROSS(DEA,DIF),DEA,'sell');
 //macd背离
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
 STICKLINE(底背离,DEA*1.09,DEA*0.86,6,0),Color00FF00;
 DRAWLINE(A1=0,DEA,底背离,DEA,0),colorred,linethick1;
 DRAWTEXT(底背离,DEA*1.09,' 底背离'),colorwhite;
 B1:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,B1+1)<CLOSE AND REF(DIF,B1+1)>DIF AND CROSS(DEA,DIF);
 DRAWLINE(B1=0,DEA,顶背离,DEA,0),colorgreen,linethick1;
 DRAWTEXT(顶背离,DEA*1.2,' 顶背离'),Color00FF00;
 //KDJ
 RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
 K:SMA(RSV,9,3),colorwhite;
 D:SMA(K,9,3),colorcyan;
 J:3*K-2*D,colormagenta;
 A2:=BARSLAST(REF(CROSS(K,D),1));
 B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);
 A3:=BARSLAST(REF(CROSS(D,K),1));
 B3:=REF(C,A2+1)<C AND REF(K,A2+1)>K AND CROSS(D,K);
 A22:=IF(ABS(D)<ABS(0.6*DEA),0.6*D*ABS(DEA/D),0.95*D);
 DRAWTEXT(B2,A22,'KDJ底背'),colorwhite;
 DRAWTEXT(B3,A22,'KDJ顶背'),colorwhite;
 DRAWICON(B2,D,'buy');
 DRAWICON(B3,D,'sell');
 B4:=CROSS(DIF,DEA) AND CROSS(K,D);
 DRAWTEXT(B4,dea*1.2,'★金叉共振'),COLOR0099FF;
 B5:=CROSS(DEA,DIF) AND CROSS(D,K);
 DRAWTEXT(B5,DEA*1.2,'★死叉共振'),COLOR0099FF;




来函数检测结果如下:
该公式没有未来函数

解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图