您的位置 首页 通达信公式

通达信EMACD指标公式

{macd背离画线}
SJ:=1;
{减4天,上方时间提前2天,30号到期28号提示}
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;
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;
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;
DRAWTEXT(NKTJ<=4*SJ&&CROSS(DIFF,DEA) AND SC2,DIFF,'风险'),COLORGREEN;
JC222:=CROSS(DIFF,DEA);
SC222:=CROSS(DEA,DIFF);
N133:=BARSLAST(JC222)+1;
N233:=BARSLAST(SC222)+1;
HH:=REF(HHV(H,N133),N233);
HH2:=REF(REF(HH,1),N233);
MHD:=VALUEWHEN(SC222,HHV(DIFF,N133));
MHD2:=VALUEWHEN(SC222,REF(MHD,1));
LL:=REF(LLV(L,N233),N133);
LL2:=REF(REF(LL,1),N133);
MLD:=VALUEWHEN(JC222,LLV(DIFF,N233));
MLD2:=VALUEWHEN(JC222,REF(MLD,1));
A:=MACD<0&&HH>HH2&&MHD<MHD2;
B:=MACD>0&&LL<LL2&&MLD>MLD2;
A1:=BACKSET(CROSS(A,0.5),REF(HHVBARS(DIFF,N133),1)+1+1);
A2:=BACKSET(CROSS(A,0.5),REF(HHVBARS(DIFF,N133),SUMBARS(SC222,2))+SUMBARS(SC222,2)+1);
B1:=BACKSET(CROSS(B,0.5),REF(LLVBARS(DIFF,N233),1)+1+1);
B2:=BACKSET(CROSS(B,0.5),REF(LLVBARS(DIFF,N233),SUMBARS(JC222,2))+SUMBARS(JC222,2)+1);
DRAWLINE(CROSS(A2,0.5),DIFF,CROSS(A1,0.5),DIFF,0),COLORRED,LINETHICK2;
DRAWLINE(CROSS(B2,0.5),DIFF,CROSS(B1,0.5),DIFF,0),COLORGREEN,LINETHICK2;
VAR6:=(2*CLOSE+HIGH+LOW)/4;
VAR8:=LLV(LOW,20);
VARAA:=HHV(HIGH,26);
B8:=EMA((VAR6-VAR8)/(VARAA-VAR8)*100,8);
B18:=EMA(B8,5);
K22:=B8>80 AND CROSS(B18,B8);
K1:=BARSLAST(K22);
K2:=REF(K1,1);
K底:=B8<20 AND CROSS(B8,B18);
K底1:=BARSLAST(K底);
K底2:=REF(K底1,1);
DRAWTEXT(REF(B8,1)*SJ>80 AND CROSS(B18,B8) AND REF(B8,1)<REF(B8,K2+2) AND REF(C,1)>REF(C,K2+2),DEA,'顶背离'),COLORCYAN;
DRAWTEXT(B8<25*SJ AND CROSS(B8,B18) AND B8>REF(B8,K底2) AND C<REF(C,K底2),DEA,'底背离'),COLORFF00FF;
通达信EMACD指标公式

本文来自网络,不代表公式指标立场,转载请注明出处:https://www.gszb.top/33756.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: admin@gszb.top

关注微信
微信扫一扫关注我们

微信扫一扫关注公众号

加入QQ群
   
微信扫一扫关注我们

QQ扫一扫加入公式群

返回顶部