MACD指标源码汇总,成功率极高,买卖点提前一目了然!
<p data-first-child >在股市投资中,MACD指标作为一种技术分析的手段,得到了投资者的认知。但如何使用MACD指标,才能使投资收益达到最佳境界,却是知者甚微。在股市操作中。MACD指标在保护投资者利益方面,远超过它发现投资机会的功效。如何巧用MACD指标.在股海中盈利,今天韩薇就给大家讲解。</p><p >一、MACD标准背离公式和选股公式</p><p >MACD指标,终极指标,也就是MACD指标的背离(背驰),是很精确的买卖点,特别是在一分钟和五分钟上的macd背离,实战效果可以说无出其右。</p><p >以下的公式源码是个标准版的MACD背离公式源码,很不错,跟系统默认的macd指标一致,而且标出了背离、金叉等,非常好。</p><p >利用此公式的操作方法:</p><p >收盘后下载数据(同时下载5分钟数据)--利用MACD背离选股公式按照5、10、15、30、60分钟分别选股--加入自选---实盘择优买入--选股的次级别(当然也包括同级别或最小的一分钟级别)顶背离后短线离场,这样基本可以有赚不赔!</p><p >1、 MACD标准背驰公式源码如下:<br/>DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);<br/>DEA:EMA(DIFF,9);<br/>MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;<br/>低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;<br/>STICKLINE(低位金叉,0,0.08,6,0),COLORYELLOW;<br/>DRAWTEXT(低位金叉,0.16,' 低位金叉'),COLORWHITE;<br/>JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));<br/>二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;<br/>STICKLINE(二次金叉,0,0.06,6,0),COLORFF00FF;<br/>DRAWICON(二次金叉,DEA*0.9,1) ;<br/>DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;<br/>A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));<br/>底背离:=REF(CLOSE,A1 1)>CLOSE AND DIFF>REF(DIFF,A1 1) AND CROSS(DIFF,DEA);<br/>STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;<br/>底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;<br/>DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;<br/>A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));<br/>顶背离:=REF(CLOSE,A2 1)DIFF AND CROSS(DEA,DIFF);<br/>顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;<br/>DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,0.25,'三全项'),COLOR0000FF,LINETHICK2;</p><p >2、MACD标准背驰选股公式:<br/>DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);<br/>DEA:=EMA(DIFF,9);<br/>MACD:=2*(DIFF-DEA);<br/>A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));<br/>底背离:REF(CLOSE,A1 1)>CLOSE AND DIFF>REF(DIFF,A1 1) AND CROSS(DIFF,DEA);</p><p >3、MACD标准背驰选股公式:<br/>DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);<br/>DEA:=EMA(DIF,9);<br/>MACD0:=(DIF-DEA)*2;<br/>MJ:=MACD0;<br/>S05:=SUM(MJ,0);<br/>QST:=BARSLAST(MJ<0 AND REF(MJ,1)>0) 1;<br/>QXT:=BARSLAST(MJ>0 AND REF(MJ,1)<0) 1;<br/>S5:=IF(MJ>0,S05-REF(S05,BARSLAST(MJ<0)),S05-REF(S05,BARSLAST(MJ>0)))/10;<br/>ST:=IF(MJ>0,REF(QST,QXT) QXT,REF(QXT,QST) QST);<br/>RS5:=REF(S5,ST);<br/>BC:IF(MJ>0 AND S5<0 AND S5>RS5 AND DEA<0,1,0));</p><p >二、MACD多周期(日、周、月)</p><p >MACD多周期指标公式:(通达信)</p><p >DIF:EMA(CLOSE,10)-EMA(CLOSE,22);<br/>DEA:EMA(DIF,7);<br/>MACD:(DIF-DEA)*2,COLORSTICK;<br/>DRAWTEXT(CROSS(DIF,DEA),DIF,'☆'),COLORRED;<br/>{DRAWICON(CROSS(DIF,DEA),DIF*1.05,1);<br/>DRAWICON(CROSS(DEA,DIF),DEA*0.90,2);}<br/>月DIF:="MACD.DIF#MONTH"COLOR0080FF;<br/>月DEA:="MACD.DEA#MONTH",COLOR0080FF,LINETHICK2;<br/>周DIF:="MACD.DIF#WEEK"COLORRED;<br/>周DEA:="MACD.DEA#WEEK",COLORRED,LINETHICK2;<br/>日DIF:="MACD.DIF",COLORWHITE;<br/>日DEA:="MACD.DEA",COLORWHITE,LINETHICK2;<br/>日金:IF(CROSS(日DIF,日DEA),0.1,0),COLORYELLOW;<br/>周金:IF(CROSS(周DIF,周DEA),0.125,0),COLORRED;<br/>月金:IF(CROSS(月DIF,月DEA),0.15,0),COLORGREEN;<br/>DRAWICON(周金 AND 日金,-0.1,7);<br/>DRAWICON(周金 AND 月金,-0.15,11);<br/>DRAWICON(日金 AND 月金,-0.1,1);<br/>日死:IF(CROSS(日DEA,日DIF),-0.1,0),COLORYELLOW;<br/>周死:IF(CROSS(周DEA,周DIF),-0.125,0),COLORRED;<br/>月死:IF(CROSS(月DEA,月DIF),-0.15,0),COLORGREEN;<br/>DRAWICON(周死 AND 日死,-0.1,8);<br/>DRAWICON(周死 AND 月死,-0.15,12);<br/>DRAWICON(日死 AND 月死,-0.15,2);</p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p >三、二次金叉,二次翻红,DIF下破0轴及0轴附近金叉</p><p >(1)二次金叉:</p><p >DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);<br/>DEA:=EMA(DIFF,9);<br/>MACD:=2*(DIFF-DEA);<br/>JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));<br/>二次金叉:CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;</p><p >(2)二次翻红:</p><p >DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); <br/>DEA:=EMA(DIFF,9); <br/>MACD:=2*(DIFF-DEA); <br/>FH1:=REF(MACD,1)<REF(MACD,2) AND REF(MACD,2)<REF(MACD,3) AND REF(MACD,3)<REF(MACD,4); <br/>FH2:=MACD>=0 AND COUNT(MACD>REF(MACD,1),1)=1; <br/>FH3:=FH1 AND FH2 AND EMA(C,13)>REF(EMA(C,13),1); <br/>FH4:=FH1 AND FH2 AND ABS((DIFF-DEA)/C)<0.018; <br/>FH5:=FH1 AND FH2 AND MACD<0.10; <br/>FH3 OR FH4 OR FH5;</p><p >(3)DIF下破0轴:</p><p >DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);</p><p >DEA:=EMA(DIFF,9);</p><p >MACD:=2*(DIFF-DEA);</p><p > 均线向上:=EMA(C,144)>=REF(EMA(C,144),1) ANDEMA(C,233)>=REF(EMA(C,233),1);</p><p >破0轴:均线向上 AND REF(DIFF,1)>0 AND DIFF<0;</p><p >(4)0轴附近金叉(特别是0轴之上):</p><p >DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);<br/>DEA:=EMA(DIF,9),LINETHICK1;<br/>CROSS(DIF,DEA) AND DEA>-0.05;</p><p >四、MACD空中加油</p><p >其中参数P1的含义:MACD 0轴之上至当前交易日的天数内曾发生过死叉<br/>P2含义: MACD 0轴之上几日内已发生金叉.<br/>即将发生金叉的条件为:<br/>DIFF在DEA之下, DEA-DIFF小于等于0.05, 且DEA与DIFF差值比前一交易周期小. (这种情况可以关注,有利于激进的朋友提前介入)<br/></p><p >N1:="MACD.DIFF"(12,26,9);<br/>N2:="MACD.DEA"(12,26,9);<br/>M1:=COUNT(CROSS(N2,N1),P1)>=1;<br/>M2:=(COUNT(CROSS(N1,N2),P2)>=1 OR (N2-N1>=0 AND N2-N1<=0.05 AND N2-N1<REF(N2-N1,1)));<br/>M3:=COUNT(N1>=0,P1)=P1;<br/>M1 AND M2 AND M3;</p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p >五、MACD双回试选出4连板牛股</p><p >{MACD双回试选股-通达信V2.1 SDCCN}</p><p >DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);</p><p >DEA:=EMA(DIF,9);</p><p >MACD:=(DIF-DEA)*2;</p><p >A1:=BARSLAST(REF(CROSS(DIF,DEA),1)); </p><p >DIF多头发散:=DIF/REF(DIF,1)>1.03 AND DIF>0;</p><p >N:=4;</p><p >DIF1:=EMA(CLOSE,12*N)-EMA(CLOSE,26*N);</p><p >DIF1多头发散:=DIF1/REF(DIF1,1)>1.03 AND DIF1>0;</p><p >量价关系:=C>REF(C,1) AND VOL/REF(VOL,1)>2;</p><p >XUANGU:A1>=5 AND A1<=13 AND CROSS(DIF,DEA) AND DIF多头发散 AND DIF1多头发散 AND 量价关系;</p><p >说明:近日符合MACD双回试选股的股票越来越多,V2.1版增加了量价关系限制条件。</p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p >六、MACD5分 15分 30分 60分跨周期在同一图表看盘</p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p >使用【MACD】5分 15分 30分 60分跨周期在同一图表看盘,做T和做短,使你更清楚自己要做什麽。体验60分与30分如图<br/>{MACD 5分}<br/>分DIFF:="MACD.DIF#MIN5"(10,22,7.5);<br/>分DEAF:="MACD.DEA#MIN5"(10,22,7.5);<br/>MACD分:2*(分DIFF-分DEAF),NODRAW;<br/>DRAWBAND(分DIFF,RGB(255,157,255),分DEAF,RGB(21,138,255));<br/>STICKLINE(MACD分>0,0,MACD分,0.01,0) ,COLOR0000FF;<br/>STICKLINE(MACD分<0,0,MACD分,0.01,0) ,COLORFFF000;<br/>GMB:IF(CROSS(分DIFF,分DEAF) AND 分DIFF>0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR0000FF;<br/>GMC:IF(CROSS(分DIFF,分DEAF) AND 分DIFF<0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR208FFF;<br/>0,COLORFFFF00,LINETHICK1;</p><p >{MACD 15分}<br/>分DIFF:="MACD.DIF#MIN15"(10,22,7.5);<br/>分DEAF:="MACD.DEA#MIN15"(10,22,7.5);<br/>MACD分:2*(分DIFF-分DEAF),NODRAW;<br/>DRAWBAND(分DIFF,RGB(255,157,255),分DEAF,RGB(21,138,255));<br/>STICKLINE(MACD分>0,0,MACD分,0.01,0) ,COLOR0000FF;<br/>STICKLINE(MACD分<0,0,MACD分,0.01,0) ,COLORFFF000;<br/>GMB:IF(CROSS(分DIFF,分DEAF) AND 分DIFF>0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR0000FF;<br/>GMC:IF(CROSS(分DIFF,分DEAF) AND 分DIFF<0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR208FFF;<br/>0,COLORFFFF00,LINETHICK1;</p><p >{MACD 30分}<br/>分DIFF:="MACD.DIF#MIN30"(10,22,7.5);<br/>分DEAF:="MACD.DEA#MIN30"(10,22,7.5);<br/>MACD分:2*(分DIFF-分DEAF),NODRAW;<br/>DRAWBAND(分DIFF,RGB(255,157,255),分DEAF,RGB(21,138,255));<br/>STICKLINE(MACD分>0,0,MACD分,0.01,0) ,COLOR0000FF;<br/>STICKLINE(MACD分<0,0,MACD分,0.01,0) ,COLORFFF000;<br/>GMB:IF(CROSS(分DIFF,分DEAF) AND 分DIFF>0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR0000FF;<br/>GMC:IF(CROSS(分DIFF,分DEAF) AND 分DIFF<0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR208FFF;<br/>0,COLORFFFF00,LINETHICK1;</p><p >{MACD 60分}<br/>分DIFF:="MACD.DIF#MIN60"(10,22,7.5);<br/>分DEAF:="MACD.DEA#MIN60"(10,22,7.5);<br/>MACD分:2*(分DIFF-分DEAF),NODRAW;<br/>DRAWBAND(分DIFF,RGB(255,157,255),分DEAF,RGB(21,138,255));<br/>STICKLINE(MACD分>0,0,MACD分,0.01,0) ,COLOR0000FF;<br/>STICKLINE(MACD分<0,0,MACD分,0.01,0) ,COLORFFF000;<br/>GMB:IF(CROSS(分DIFF,分DEAF) AND 分DIFF>0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR0000FF;<br/>GMC:IF(CROSS(分DIFF,分DEAF) AND 分DIFF<0,-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLOR208FFF;<br/>0,COLORFFFF00,LINETHICK1;</p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p class="ztext-empty-paragraph"><br/></p><p >也可下载下面的文件复制到“tdx_level2T0002pad”的文件夹中,这是做好的,公式是主图<br/>公式源码:<br/>QWX1:=HHV(CLOSE,30);<br/>QWX2:=LLV(CLOSE,30);<br/>QWX3:=CONST((QWX1+QWX2)/2);</p><p >DIFF:(EMA(CLOSE,10) - EMA(CLOSE,22))*60+QWX3,NODRAW;<br/>DEA :EMA(DIFF,7.5),NODRAW;<br/>MACD :2*(DIFF-DEA)+QWX3,NODRAW;<br/>DRAWBAND(DIFF,RGB(255,157,255),DEA,RGB(21,138,255));<br/>STICKLINE(MACD>0+QWX3,0+QWX3,MACD,0.2,0) ,COLOR0000FF;<br/>STICKLINE(MACD<0+QWX3,0+QWX3,MACD,0.2,0) ,COLORFFF000;<br/>趋势:=((5)*(SMA(((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27)))*(100),5,1))-(3)*(SMA(SMA(((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27)))*(100),5,1),3,1))-SMA(SMA(SMA(((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27)))*(100),5,1),3,1),2,1))*60+QWX3;<br/>STICKLINE(趋势<=5*60+QWX3,0+QWX3,MACD,0.2,0) ,COLOR00FFFF;<br/>0+QWX3,COLORFFFF00,LINETHICK1;<br/>DRAWICON(CROSS(DEA,DIFF) AND DIFF>0+QWX3,DEA,2);<br/>DRAWICON(CROSS(DIFF,DEA) AND DIFF<0+QWX3,DEA,1);</p><p >笔者公众平台:k603000(李韩薇)</p> good!vevy good! 非常好,赞一个! 帮帮顶顶!! 只为积分!感谢! 多谢分享!
页:
[1]