MACD是经典指标,MACD属于趋势类指标,一般来说比较稳定,能过滤一般无用的信号。MACD的参数可以改,因为以前是每周6个交易日,现在是5个交易日,12是两周,26是每30天减4个周日,9是1周半。按现在的5个交易日改:10 22 7.5。大小周期与K线结合着看。
{草根 MACD}
DIFF:EMA(CLOSE,10) - EMA(CLOSE,22),LINETHICK0;
DEA :EMA(DIFF,7.5),LINETHICK0;
MACD :2*(DIFF-DEA),LINETHICK0;
FILLRGN(DIFF>DEA,DIFF,DEA),ColorFF9DFF;
FILLRGN(DIFF<DEA,DIFF,DEA),ColorFF8A15;
PARTLINE(CROSS(DIFF,DEA) AND DIFF>0,DIFF),CIRCLEDOT,LINETHICK3,COLOR00ffff,pxup6;
PARTLINE(CROSS(DIFF,DEA) AND DIFF<0,DIFF),CROSSDOT,LINETHICK3,COLORff00FF,pxup6;
STICKLINE(MACD>0,0,MACD,3,0) ,COLOR0000FF;
STICKLINE(MACD<0,0,MACD,3,0) ,COLORFFF000;
趋势:=(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);
STICKLINE(趋势<=5,0,MACD,3,0) ,COLOR208FFF;
0,COLORFFFF00,LINETHICK1;
A1:=BARSLAST(ref(cross("macd.diff","macd.dea"),1));
B1:=ref(c,A1+1)>c and ref("macd.diff",A1+1)<"macd.diff" and cross("macd.diff","macd.dea");
DRAWTEXT(FILTER(B1>0,5),0,'MACD'),COLORGREEN,ALIGN0,pxDN15;
A2:=BARSLAST(ref(cross("kdj.k","kdj.d"),1));
B2:=ref(c,A2+1)>c and ref("kdj.k",A2+1)<"kdj.k" and cross("kdj.k","kdj.d");
DRAWTEXT(FILTER(B2>0,5),0,'KDJ'),COLORYELLOW,ALIGN0,pxDN35;
A3:=BARSLAST(ref(cross("RSI.RSI1","RSI.RSI2"),1));
B3:=ref(c,A3+1)>c and ref("RSI.RSI1",A3+1)<"RSI.RSI1" and cross("RSI.RSI1","RSI.RSI2");
DRAWTEXT(FILTER(B3>0,5),0,'RSI'),COLORCYAN,ALIGN0,pxDN55;
DRAWICON(FILTER(B1>0,5) or FILTER(B2>0,5) or FILTER(B3>0,5),0,12),ALIGN0,pxDN95;
C1:=BARSLAST(ref(cross("macd.dea","macd.diff"),1));
D1:=ref(c,C1+1)<c and ref("macd.diff",C1+1)>"macd.diff" and cross("macd.dea","macd.diff");
DRAWTEXT(FILTER(D1>0,5),0,'MACD'),COLORwhite,ALIGN0,pxUP25;
C2:=BARSLAST(ref(cross("kdj.d","kdj.k"),1));
D2:=ref(c,C2+1)<c and ref("kdj.k",C2+1)>"kdj.k" and cross("kdj.d","kdj.k");
DRAWTEXT(FILTER(D2>0,5),0,'KDJ'),COLORwhite,ALIGN0,pxUP45;
C3:=BARSLAST(ref(cross("RSI.RSI2","RSI.RSI1"),1));
D3:=ref(c,C3+1)<c and ref("RSI.RSI1",C3+1)>"RSI.RSI1" and cross("RSI.RSI2","RSI.RSI1");
DRAWTEXT(FILTER(D3>0,5),0,'RSI'),COLORMAGENTA,ALIGN0,pxUP65;
DRAWICON(FILTER(D1>0,5) or FILTER(D2>0,5) or FILTER(D3>0,5),0,10),ALIGN0,pxUP85;
G:=IF((SYSPARAM(1) = (BARSSINCE((C > 0)) + 1)),1,0);
DRAWTEXT(((G > 0) AND FILTER(B1>0,5)),0,'金叉'),color00fFEE,pxDN65,ALIGN2;
DRAWTEXT(((G > 0) AND FILTER(B2>0,5)),0,'金叉'),color00fFEE,pxDN65,ALIGN2;
DRAWTEXT(((G > 0) AND FILTER(B3>0,5)),0,'金叉'),color00fFEE,pxDN65,ALIGN2;
DRAWTEXT(((G > 0) AND FILTER(D1>0,5)),0,'死叉'),colorfFAAEE,pxUP75,ALIGN1;
DRAWTEXT(((G > 0) AND FILTER(D2>0,5)),0,'死叉'),colorfFAAEE,pxUP75,ALIGN1;
DRAWTEXT(((G > 0) AND FILTER(D3>0,5)),0,'死叉'),colorfFAAEE,pxUP75,ALIGN1;