利用极品MACD、趋势MACD副图可以知道当前个股是上涨行情的初期还是末期??是下跌开始还是末期??
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2,COLORSTICK;
W1:STICKLINE(MACD 0,MACD,0,3,1),COLORRED;
W2:STICKLINE(MACD 0,MACD,0,3,1),COLORCYAN;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,1.2,1 ),COLOR00CCFF;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,1.65,1 ),COLOR00DDFF;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,1.1,1 ),COLOR00EEFF;
STICKLINE(MACD =REF(MACD,1)AND MACD 0,0,MACD,1.1 ,1 ),COLOR0044EE;
STICKLINE(MACD =REF(MACD,1)AND MACD 0,0,MACD,0.55 ,1 ),COLOR0055FF;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,2.0 ,1 ),COLORBB11BB;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,1.2,1 ),COLORCC22BB;
STICKLINE(MACD REF(MACD,1)AND MACD 0,0,MACD,1.65,1 ),COLORDD33BB;
STICKLINE(MACD =REF(MACD,1)AND MACD 0,0,MACD,1.1 ,1 ),COLORFFEE44;
STICKLINE(MACD =REF(MACD,1)AND MACD 0,0,MACD,0.55 ,1 ),COLORFFFF55;
VA1:=HHVBARS(MACD,BARSLAST(MACD 0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD),REF(VA1,1)+2),0.5);
QG:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD 0),REF(VA1,1)+2),0.5);
前高:DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORMAGENTA,DOTLINE;
VA3:=LLVBARS(MACD,BARSLAST(MACD 0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0),REF(VA3,1)+2),0.5);
BD:=BARSLAST(FILTERX(CROSS(0,MACD),BARSCOUNT(C)));
前低:DRAWLINE(VA4,MACD,REF(VA4,1),REF(MACD,1),1),CIRCLEDOT;
BDTJ:=IF(MACD 0,FILTERX(MACD=LLV(MACD,BARSLAST(MACD 0)),
BARSCOUNT(C)),DRAWNULL);
TSBDTJ:=BARSLAST(BDTJ);
BDZH:=FILTERX(MACD CONST(LLV(MACD,BD+1)),BARSCOUNT(C));
BDTS:=BARSLAST(BDZH);
本低:IF(BD+1 =1,CONST(LLV(MACD,BD+1)),DRAWNULL);
BDCL:=CROSS(COUNT(CROSS(MACD 本低/2 AND MACD 0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ
终点:=IF(ISLASTBAR AND MACD 0 AND MACD=HHV(MACD,BARSLAST(MACD 0)),1,
IF(FILTERX(QG,BARSCOUNT(C)),2,DRAWNULL));
UU:=(终点=1 OR 终点=2) AND MACD
ZZ:=FILTERX(UU,BARSCOUNT(C));
本高:DRAWLINE(ZZ,MACD,REF(ZZ,1),REF(MACD,1),1),COLORWHITE;
横线:=CONST(REF(MACD,BARSLAST(ZZ)));
WW:=MACD
起始点:=FILTERX(REFX(BARSLAST(WW),1)=1,BARSCOUNT(C));
天数:BARSLAST(起始点),COLORYELLOW,NODRAW;
上横线:DRAWLINE(起始点,横线,ZZ,横线,0),COLORGREEN,DOTLINE;
下横线:DRAWLINE(BDZH,CONST(LLV(MACD,BD+1)),BDTJ=1,MACD,0),COLOR8080FF,DOTLINE;
DRAWNUMBER(BDTJ,CONST(LLV(MACD,BD+1))*0.9,BDTS);
DRAWNUMBER(ZZ,上横线*1.1,天数);
TJ:=IF(起始点,BARSNEXT(ZZ),DRAWNULL);
红柱数量:IF(天数 0 AND 天数 =REF(TJ,天数),SUM(MACD 0,天数),DRAWNULL),COLORWHITE,NODRAW;
横线起始价:REF(C,天数),NODRAW;
空间评估:(横线起始价-C)/C*100,NODRAW;
TT:=BARSLAST(ZZ);
WQG:=CROSS(COUNT(CROSS(MACD 本高/2 AND MACD 0,0.5),ZZ)=1,0.5) AND ZZ
STICKLINE(MACD 前高 AND 本高 前高 AND BARSLAST(CROSS(MACD 本高/2,0.5)) 0 AND
MACD (前高+本高)/2,MACD,前高,1,0),COLORYELLOW;
前高本高二分位:IF(MACD 0 AND 本高!=前高,DRAWLINE(WQG,(前高+本高)/2,REF(WQG,1),REF((前高+本高)/2,1),1)
,DRAWNULL),COLORC0C000,DOTLINE;
AA:=STRCAT(STRCAT(STRCAT('〖','上升空间'),'〗'),CON2STR(IF(空间评估,空间评估,
DRAWNULL),2));
DRAWTEXT(WQG,MACD*1.1,'本高成立'),COLORWHITE;
DRAWTEXT(BDCL,MACD*1.1,'本低成立'),COLORWHITE;
STICKLINE(MACD 前高,MACD,前高,1,0),COLORYELLOW;
STICKLINE(WQG,MACD,0,1,0),COLORGREEN;
STICKLINE(MACD 0 AND MACD 前低 AND 前低 0,MACD,前低,1,0),COLORBLUE;
B1:=IF(CROSS(MACD 0,0.5),BARSNEXT(BDTJ),DRAWNULL);
TSB1:=BARSLAST(MACD 0)-1;
STICKLINE(BARSLAST(BDCL) =0 AND MACD 前低 AND MACD 0,MACD,前低,1,0),COLORGREEN;
STICKLINE(BDCL,MACD,0,1,0),COLORWHITE;
STICKLINE(MACD 前高 AND 本高 前高 AND BARSLAST(WQG) 0,
MACD,前高,1,0),COLORRED;
DRAWTEXT(VA2 AND VA2!=UU,(MACD/10)*9,'前');
DRAWTEXT(VA2 AND VA2!=UU,MACD/10,'高');
DRAWTEXT(ZZ,(MACD/10)*9,'本'),COLORWHITE;
DRAWTEXT(ZZ,MACD/10,'高'),COLORWHITE;
DRAWTEXT(BDTJ,(MACD/10)*9,'低'),COLORRED;
DRAWTEXT(BDTJ,MACD/10,'本'),COLORRED;
IF(BARSLAST(BDCL) =0,本低/2,DRAWNULL),COLORRED,DOTLINE;
基准:=CONST(SUM(VA2,0));
前高L:=基准=SUM(VA2,0) AND VA2,COLORCYAN,NODRAW;
前高1:=基准-1=SUM(VA2,0) AND VA2,COLORYELLOW,NODRAW;
前高2:=基准-2=SUM(VA2,0) AND VA2,COLORWHITE,NODRAW;
前高3:=基准-3=SUM(VA2,0) AND VA2,COLORWHITE,NODRAW;
前高4:=基准-4=SUM(VA2,0) AND VA2,COLORWHITE,NODRAW;
距离G1:=BARSLAST(前高1);
距离G2:=BARSLAST(前高2);
距离G3:=BARSLAST(前高3);
距离G4:=BARSLAST(前高4);
NOTEXTG2:DRAWLINE(前高1,MACD,前高L AND MACD =REF(MACD,距离G1),MACD,0),COLORYELLOW;
NOTEXTG1:DRAWLINE(前高1,MACD,前高L AND MACD REF(MACD,距离G1),MACD,0),COLORGREEN;
NOTEXTG3:DRAWLINE(前高2,MACD,前高1 AND MACD =REF(MACD,距离G2),MACD,0),COLORYELLOW;
NOTEXTG4:DRAWLINE(前高2,MACD,前高1 AND MACD REF(MACD,距离G2),MACD,0),COLORGREEN;
NOTEXTG5:DRAWLINE(前高3,MACD,前高2 AND MACD =REF(MACD,距离G3),MACD,0),COLORYELLOW;
NOTEXTG6:DRAWLINE(前高3,MACD,前高2 AND MACD REF(MACD,距离G3),MACD,0),COLORGREEN;
NOTEXTG7:DRAWLINE(前高4,MACD,前高3 AND MACD =REF(MACD,距离G4),MACD,0),COLORYELLOW;
NOTEXTG8:DRAWLINE(前高4,MACD,前高3 AND MACD REF(MACD,距离G4),MACD,0),COLORGREEN;
基准2:=CONST(SUM(VA4,0));
前低L:=基准2=SUM(VA4,0) AND VA4;
前低1:=基准2-1=SUM(VA4,0) AND VA4;
前低2:=基准2-2=SUM(VA4,0) AND VA4;
前低3:=基准2-3=SUM(VA4,0) AND VA4;
前低4:=基准2-4=SUM(VA4,0) AND VA4;
距离D1:=BARSLAST(前低1);
距离D2:=BARSLAST(前低2);
距离D3:=BARSLAST(前低3);
距离D4:=BARSLAST(前低4);
NOTEXTD1:DRAWLINE(前低1,MACD,前低L AND MACD =REF(MACD,距离D1),MACD,0),COLORYELLOW;{好股票网 http://www.goodgupiao.com 整理}
NOTEXTD2:DRAWLINE(前低1,MACD,前低L AND MACD REF(MACD,距离D1),MACD,0),COLORGREEN;
NOTEXTD3:DRAWLINE(前低2,MACD,前低1 AND MACD =REF(MACD,距离D2),MACD,0),COLORYELLOW;
NOTEXTD4:DRAWLINE(前低2,MACD,前低1 AND MACD REF(MACD,距离D2),MACD,0),COLORGREEN;
NOTEXTD5:DRAWLINE(前低3,MACD,前低2 AND MACD =REF(MACD,距离D3),MACD,0),COLORYELLOW;
NOTEXTD6:DRAWLINE(前低3,MACD,前低2 AND MACD REF(MACD,距离D3),MACD,0),COLORGREEN;
NOTEXTD7:DRAWLINE(前低4,MACD,前低3 AND MACD =REF(MACD,距离D4),MACD,0),COLORYELLOW;
NOTEXTD8:DRAWLINE(前低4,MACD,前低3 AND MACD REF(MACD,距离D4),MACD,0),COLORGREEN;
STICKLINE(MACD 前高 AND 本高 前高 AND BARSLAST(WQG) 0,
MACD,前高,1,0),COLORRED;
DRAWTEXT(VA2 AND VA2!=UU,(MACD/10)*9,'前');
DRAWTEXT(VA2 AND VA2!=UU,MACD/10,'高');
DRAWTEXT(ZZ,(MACD/10)*9,'本'),COLORWHITE;
DRAWTEXT(ZZ,MACD/10,'高'),COLORWHITE;
DRAWTEXT(BDTJ,(MACD/10)*9,'低'),COLORRED;
DRAWTEXT(BDTJ,MACD/10,'本'),COLORRED;
IF(BARSLAST(BDCL) =0,本低/2,DRAWNULL),COLORRED,DOTLINE;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORMAGENTA;
DEAA:EMA(DIF,9),COLORWHITE;
低位金叉:=CROSS(DIFF,DEA) AND DIFF -0.1;
STICKLINE(低位金叉,0,0.08,2,0),COLORYELLOW;
DRAWTEXT(低位金叉,0.16,' 低位金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA =0));
二次金叉:=CROSS(DIFF,DEA) AND DEA 0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,0.06,2,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1) CLOSE AND DIFF REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.03,2,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLOR008080,LINETHICK4;
DRAWTEXT(底背离,0.1,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1) CLOSE AND REF(DIFF,A2+1) DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;
DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,0.25,'三全项'),COLOR0000FF,LINETHICK2;
DRAWTEXT_FIX(1,0.05,0.04,0,'【黑马拉升由两个阶段构成:同步上涨阶段(红芯柱)
和惯性上涨阶段(背离阶段、黄芯柱)】'),COLORFFFF00;
趋势MACD-----副图公式
DIFF:=( EMA(CLOSE,12) - EMA(CLOSE,26))*100;
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
STICKLINE(DIFF 0,0,DIFF,2,0),COLOR00FF00;
STICKLINE(DIFF =0,0,DIFF,2,0),COLORRED;
STICKLINE(DEA =0,0,DEA,2,0),COLORBLUE;
STICKLINE(DEA 0,0,DEA,2,0),COLORYELLOW;
DRAWICON(CROSS(DIFF,DEA),DEA*1.1,1);
DRAWICON(CROSS(DEA,DIFF),DEA*1.1,2);
强1:IF(DIFF DEA,DIFF,0),COLORRED;
强2:IF(DEA DIFF,DEA,0),COLORMAGENTA;
抄底:=ABS((CROSS(DIFF,DEA) AND DEA =-0.07)*DIFF)*1.09,LINETHICK2;
DRAWTEXT(ABS(抄底) 0,DEA*0.1,' 底'),COLORFFFF00;
DRAWICON(ABS(抄底) 0,DEA*0.3,9);