在线检测未来函数

通达信多线MACD指标公式

来源:Internet,编辑:股旁网,2020-02-21

N1:=30;
N2:=60;
N3:=90;
N4:=120;
N5:=150;
M:=12;
Q:=9;
DIFF:=(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:=EMA(DIFF,9);
MACD2:=2*(DIFF-DEA);
STICKLINE(MACD2>=0,0,MACD2,2,0),COLORFF00FF;
STICKLINE(MACD2>=0 AND MACD2<REF(MACD2,1),0,MACD2,2,1),COLORGREEN;
STICKLINE(MACD2<0,0,MACD2,2,0),COLORFFFF00;
STICKLINE(MACD2<0 AND MACD2>REF(MACD2,1),0,MACD2,2,0),COLORYELLOW;
DIFF_1:=(EMA(CLOSE,M)-EMA(CLOSE,N1));
DEA_1:=EMA(DIFF_1,Q);
MACD_1:=2*(DIFF_1-DEA_1);
DIFF_2:=(EMA(CLOSE,M)-EMA(CLOSE,N2));
DEA_2:=EMA(DIFF_2,Q);
MACD_2:=2*(DIFF_2-DEA_2);
DIFF_3:=(EMA(CLOSE,M)-EMA(CLOSE,N3));
DEA_3:=EMA(DIFF_3,Q);
MACD_3:=2*(DIFF_3-DEA_3);
DIFF_4:=(EMA(CLOSE,M)-EMA(CLOSE,N4));
DEA_4:=EMA(DIFF_4,Q);
MACD_4:=2*(DIFF_4-DEA_4);
DIFF_5:=(EMA(CLOSE,M)-EMA(CLOSE,N5));
DEA_5:=EMA(DIFF_5,Q);
MACD_5:=2*(DIFF_5-DEA_5);
X_1:=EMA(SUM(MACD_1,2),3);
X_2:=EMA(SUM(MACD_2,2),3);
X_3:=EMA(SUM(MACD_3,2),3);
X_4:=EMA(SUM(MACD_4,2),3);
X_5:=EMA(SUM(MACD_5,2),3);
多线MACD:(X_1+X_2+X_3+X_4+X_5)/5,COLORBLUE,LINETHICK2;
均线:MA(多线MACD,3);
TJ_B1:=(HHV(MACD_1,4)<0 AND MACD_1>REF(MACD_1,1) AND REF(MACD_1,1)<REF(MACD_1,2) AND REF(MACD_1,2)<REF(MACD_1,3));
TJ_S1:=(LLV(MACD_1,4)>0 AND MACD_1<REF(MACD_1,1) AND REF(MACD_1,1)>REF(MACD_1,2) AND REF(MACD_1,2)>REF(MACD_1,3));
TJ_B2:=(HHV(MACD_2,4)<0 AND MACD_2>REF(MACD_2,1) AND REF(MACD_2,1)<REF(MACD_2,2) AND REF(MACD_2,2)<REF(MACD_2,3));
TJ_S2:=(LLV(MACD_2,4)>0 AND MACD_2<REF(MACD_2,1) AND REF(MACD_2,1)>REF(MACD_2,2) AND REF(MACD_2,2)>REF(MACD_2,3));
TJ_B3:=(HHV(MACD_3,4)<0 AND MACD_3>REF(MACD_3,1) AND REF(MACD_3,1)<REF(MACD_3,2) AND REF(MACD_3,2)<REF(MACD_3,3));
TJ_S3:=(LLV(MACD_3,4)>0 AND MACD_3<REF(MACD_3,1) AND REF(MACD_3,1)>REF(MACD_3,2) AND REF(MACD_3,2)>REF(MACD_3,3));
TJ_B4:=(HHV(MACD_4,4)<0 AND MACD_4>REF(MACD_4,1) AND REF(MACD_4,1)<REF(MACD_4,2) AND REF(MACD_4,2)<REF(MACD_4,3));
TJ_S4:=(LLV(MACD_4,4)>0 AND MACD_4<REF(MACD_4,1) AND REF(MACD_4,1)>REF(MACD_4,2) AND REF(MACD_4,2)>REF(MACD_4,3));
TJ_B5:=(HHV(MACD_5,4)<0 AND MACD_5>REF(MACD_5,1) AND REF(MACD_5,1)<REF(MACD_5,2) AND REF(MACD_5,2)<REF(MACD_5,3));
TJ_S5:=(LLV(MACD_5,4)>0 AND MACD_5<REF(MACD_5,1) AND REF(MACD_5,1)>REF(MACD_5,2) AND REF(MACD_5,2)>REF(MACD_5,3));
BB_TJ:=(TJ_B1+TJ_B2+TJ_B3+TJ_B4+TJ_B5)>=3,NODRAW;
SS_TJ:=(TJ_S1+TJ_S2+TJ_S3+TJ_S4+TJ_S5)>=3;
DRAWICON(TJ_B1,多线MACD,1);
DRAWICON(TJ_S1,多线MACD,2);
DRAWICON(TJ_B2,多线MACD,1);
DRAWICON(TJ_S2,多线MACD,2);
DRAWICON(TJ_B3,多线MACD,1);
DRAWICON(TJ_S3,多线MACD,2);
DRAWICON(TJ_B4,多线MACD,1);
DRAWICON(TJ_S4,多线MACD,2);
DRAWICON(TJ_B5,多线MACD,1);
DRAWICON(TJ_S5,多线MACD,2);
DRAWICON(BB_TJ,多线MACD,34);
DRAWICON(SS_TJ,多线MACD,35);

通达信多线MACD指标公式

 

相关文章