MACD背离画线增加买卖背离和划线提示通达信公式 副图 源码附图

SJ:=1;
 DIFF:(EMA(CLOSE,12)*SJ - EMA(CLOSE,26)*SJ);
 DEA:EMA(DIFF,9)*SJ;
 MACD2:(2 * (DIFF - DEA))*SJ,COLORSTICK;
{股票指标网 整理}
J:=CROSS(DIFF,DEA);
S:=CROSS(DEA,DIFF);
JC:=COUNT(J,BARSLAST(CROSS(DIFF>0&&DEA>0,0.5)))=1&&J;
SC:=COUNT(S,BARSLAST(CROSS(0.5,DIFF>0&&DEA>0)))=1&&S;
JC2:=COUNT(S,BARSLAST(CROSS(0.5,DIFF>0&&DEA>0)))=2&&S;
SC2:=COUNT(J,BARSLAST(CROSS(DIFF>0&&DEA>0,0.5)))=2&&J;
N1:=SUMBARS(CROSS(DEA,DIFF),1);
N2:=SUMBARS(CROSS(DIFF,DEA),1);
DRAWTEXT(N2=1&&N1>5&&N1<=13*SJ&&EVERY(DIFF>0&&DEA*SJ>0 ,N1)&&JC,DIFF,'多'),COLORRED,DRAWABOVE;
 
 
M:=SUMBARS((DIFF<0&&CROSS(0,DEA))||(CROSS(0,DIFF)&&DEA<0),1);
M1:=SUMBARS(CROSS(DIFF,DEA),1);
M2:=SUMBARS(CROSS(DEA,DIFF),1);
DRAWTEXT(M2=1&&M1*SJ>5&&M1<=13*SJ&&EVERY(DIFF<0&&DEA<0,N2) &&SC,DIFF,'空'),COLORGREEN,DRAWABOVE;
 
 
NDTJ:=SUMBARS(N2=1&&N1>5&&N1<=13&&EVERY(DIFF>0&&DEA>0,N1),1);
NKTJ:=SUMBARS(M2=1&&M1>5&&M1<=13&&EVERY(DIFF<0&&DEA<0,N2),1);
DRAWTEXT(NDTJ<=4*SJ&&CROSS(DEA,DIFF) AND JC2,DIFF,'风险'),COLORRED,DRAWABOVE;
DRAWTEXT(NKTJ<=4*SJ&&CROSS(DIFF,DEA) AND SC2,DIFF,'风险'),COLORGREEN,DRAWABOVE;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=(REF(L,A1+1)>L OR REF(C,A1+1)>C) AND (L,DIFF)*SJ>REF((L,DIFF),A1+1) AND CROSS(DIFF,DEA);
{DRAWTEXT(底背离,DEA,'底背离')COLORRED;}
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORGREEN,LINETHICK2;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=(REF(C,A2+1)<C*SJ OR REF(H,A2+1)<H*SJ) AND REF((H,DIFF),A2+1)>(H,DIFF) AND CROSS(DEA,DIFF);
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORRED,LINETHICK2;
{DRAWTEXT(顶背离,DEA,'顶背离')COLORGREEN;}
VAR6:=(2*CLOSE+HIGH+LOW)/4;
VAR8:=LLV(LOW,20);
VARAA:=HHV(HIGH,26);
B:=EMA((VAR6-VAR8)/(VARAA-VAR8)*100,8);
B1:=EMA(B,5);
K22:=B>80 AND CROSS(B1,B);
K1:=BARSLAST(K22);
K2:=REF(K1,1);
K底:=B<20 AND CROSS(B,B1);
K底1:=BARSLAST(K底);
K底2:=REF(K底1,1);
{股票指标网 整理}
DRAWTEXT(REF(B,1)*SJ>80 AND CROSS(B1,B) AND REF(B,1)<REF(B,K2+2) AND REF(C,1)>REF(C,K2+2),DEA,'顶背离'),COLORCYAN;
DRAWTEXT(B<25*SJ AND CROSS(B,B1) AND B>REF(B,K底2) AND C<REF(C,K底2),DEA,'底背离'),COLORFF00FF;



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

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

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

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