通达信MACD背离源码

DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);

MACD:=EMA(DIF,9),COLOR33CCFF;

DEF:2*(DIF-MACD),COLORFFFF00,LINETHICK0;

STICKLINE(DEF>=0 AND DEF>=REF(DEF,1),0,DEF,0,0),COLORRED;

STICKLINE(DEF>=0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORRED;

STICKLINE(DEF<0 AND DEF>=REF(DEF,1),0,DEF,0.0,0),COLORCYAN;

STICKLINE(DEF<0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORCYAN;

IF(DIF<1000,0,DRAWNULL),COLORBROWN;

K1:=BACKSET(DIF>REF(DIF,1),2);

强DIF:IF(K1,DIF,DRAWNULL),COLORRED;

K2:=BACKSET(DIF<REF(DIF,1),2);

弱DIF:IF(K2,DIF,DRAWNULL),COLORFF8B80;

K3:=BACKSET(MACD>REF(MACD,1),2);

强MACD:IF(K3,MACD,DRAWNULL),COLORLIRED;

K4:=BACKSET(MACD<REF(MACD,1),2);

弱MACD:IF(K4,MACD,DRAWNULL),COLORFF8B80;
底拐: DRAWLINE(DIF>=HHV(DIF,21),DIF,DIF<=LLV(DIF,21),DIF,1),COLORWHITE,POINTDOT;

DRAWICON(强DIF>底拐 AND REF(DIF,1)=REF(底拐,1) AND REF(DIF,2)>REF(DIF,1),0,1);

A1:=BARSLAST(REF(CROSS(DIF,MACD),1));

底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,MACD);

DRAWLINE(A1=0,MACD,底背离,MACD,0),COLORYELLOW,LINETHICK2;

 

A2:=BARSLAST(REF(CROSS(MACD,DIF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(MACD,DIF);

DRAWLINE(A2=0,MACD,顶背离,MACD,0),COLORGREEN,LINETHICK2;

AA1:=IF(DEF>0,1,-1);
 AA2:=REF(AA1,1);

AA3:=AA1*AA2;
 AA4:=BARSLAST(AA3<0);

AA5:=AA4+1;

面积:SUM(DEF,AA5)/10,COLORGREEN;




未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式

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

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