MACD的精华-精品通达信指标公式源码分享
公式1:
DIFF1:=EMA(CLOSE,16) - EMA(CLOSE,58),COLORWHITE;
DEA1:=EMA(DIFF1,88),COLORYELLOW;
MACD1:2*(DIFF1-DEA1)*100 ;
MAMACD1:MA(MACD1,5),,COLORWHITE;
DIFF:=EMA(CLOSE,8) - EMA(CLOSE,26),COLORWHITE;
DEA:=EMA(DIFF,50),COLORYELLOW;
MACD:2*(DIFF-DEA)*100 ;
MAMACD:MA(MACD,5),,COLORWHITE;
STICKLINE(MACD1<MAMACD1,0,MACD1,1,0),COLORGREEN;
STICKLINE(MACD>MAMACD,MACD1*0.6,0,1,0),COLORYELLOW;
STICKLINE(MACD<0,MAMACD,MACD1,1,0),COLORGREEN;
STICKLINE(MACD1>MAMACD1 AND MACD>MAMACD ,0,MACD1,1,0),COLORRED;
公式2:
v1:=MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1));
v2:=MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
分水岭:IF(MA(CLOSE,17)<v2,v2,MA(CLOSE,17)),COLORFF00FF,LINETHICK1;
ma10:=MA(C,10),COLORWHITE,LINETHICK1;
ma30:MA(C,30),COLOR00ff00,LINETHICK2;
stickline(ma10>= REF(ma10,1),ma10,ref(ma10,1),8,1),COLORRED,LINETHICK2;
stickline(ma10< REF(ma10,1),ma10,ref(ma10,1),8,1),COLORff9900,LINETHICK2;
A1:=BARSLAST(REF(CROSS("MACD.DIFF"(12,26,9),"MACD.DEA"(12,26,9)),1));
B1:=REF(C,A1+1)> C AND REF("MACD.DIFF"(12,26,9),A1+1)<"MACD.DIFF"(12,26,9)
AND CROSS("MACD.DIFF"(12,26,9),"MACD.DEA"(12,26,9));
DRAWTEXT(B1> 0,L-0.02,'底背离'),COLOR00FFFF;{底背离}
C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIFF"(12,26,9)),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIFF"(12,26,9),C1+1)>"MACD.DIFF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),
"MACD.DIFF"(12,26,9));
DRAWTEXT(D1> 0,H+0.16,'顶背离'),COLOR00FF00;{顶背离}
Jm:=CROSS("Macd.DIFF"(12,26,9),"Macd.DEA"(12,26,9));
Jma:=CROSS("Macd.DEA"(12,26,9),"Macd.DIFF"(12,26,9));
Drawtext (Jm,l,'金叉'),colorwhite;{金叉}
Drawtext (Jma,h,'死叉'),coloryellow;{死叉}
JmCOUNT:=COUNT(Jm,BARSLAST("Macd.DEA"(12,26,9)>=0));
Jmtj:1*("Macd.DEA"(12,26,9)<0 and Count(JmCount=2,21)=1);
JmaCOUNT:=COUNT(Jma,BARSLAST("Macd.DEA"(12,26,9)>=0));
Jmatj:1*("Macd.DEA"(12,26,9)>0 and Count(JmaCount=2,21)=1);
Drawtext (Jmtj,l,'二次金叉'),colorwhite;{macd二次金叉}
Drawtext (Jmatj,h,'二次死叉'),colorwhite;{macd二次死叉}
版权声明
本文版权归掌上指标所有。
未经许可,不得转载,转载请注明出处!