日趋完善的MACD指标

M:缺省7 N:缺省11


 


 VAR1:=EMA(SLOPE(C,21)+C,34);
 VAR5:=EMA(C,2);
 VAR9:=VAR5-VAR1;
 ZJC:=VAR9;
 ZJH:=IF(C>O,(H-C)/(C-L)*(C-L)+ZJC,(H-C)/(O-L)*(O-L)+ZJC);
 ZJO:=IF(C>O,ZJH-(H-O)/(C-L)*(C-L),ZJH-(H-O)/(O-L)*(O-L));
 ZJL:=IF(C>O,ZJH-(H-L)/(H-O)*(H-O),ZJH-(H-L)/(H-C)*(H-C));
 WDDIF:EMA(ZJC*5,10)-EMA(ZJC*5,20);
 WDDEA:EMA(WDDIF,8);
 WDMACD:(WDDIF-WDDEA)*2,COLORSTICK;
收盘值:ZJC,COLORLIBLUE,NODRAW;
 AA:=REF(ZJC,M)=HHV(ZJC,2*M+1);
 BB:=BACKSET(AA,M+1);
 CC:=FILTER(BB,M) AND ZJC=HHV(ZJC,M+1);
 A:=BARSLAST(REF(CC,1));
 AA1:=REF(ZJC,2)=HHV(ZJC,2*2+1);
 BB1:=BACKSET(AA1,2+1);
 CC1:=FILTER(BB1,2) AND ZJC=HHV(ZJC,2+1);
 A1:=BARSLAST(REF(CC1,1));
 TJ:=REF(C,A1+1)<C AND REF(ZJC,A1+1)>ZJC AND CC1;
 DBL:=IF((REF(C,A+1)<C AND REF(ZJC,A+1)>ZJC AND CC) OR TJ,8,DRAWNULL)COLORGREEN,NODRAW;
顶背离:DRAWLINE(CC,ZJC,FILTER(DBL>0,5),ZJC,0)LINETHICK2,COLORGREEN;
 DRAWTEXT(DBL=8,ZJH*1.1,'顶背离')COLORGREEN;
 AA2:=REF(ZJC,N)=LLV(ZJC,2*N+1);
 BB2:=BACKSET(AA2,N+1);
 CC2:=FILTER(BB2,N) AND ZJC=LLV(ZJC,N+1);
 A2:=BARSLAST(REF(CC2,1));
 AA3:=REF(ZJC,2)=LLV(ZJC,2*2+1);
 BB3:=BACKSET(AA3,2+1);
 CC3:=FILTER(BB3,2) AND ZJC=LLV(ZJC,2+1);
 A3:=BARSLAST(REF(CC3,1));
 TJ1:=REF(C,A3+1)>C AND REF(ZJC,A3+1)<ZJC AND CC3;
 XG:=IF((REF(C,A2+1)>C AND REF(ZJC,A2+1)<ZJC AND CC2) OR TJ1,8,DRAWNULL)COLORRED,NODRAW;
选股:DRAWLINE(CC2,ZJC,FILTER(XG>0,5),ZJC,0)LINETHICK2,COLORRED;
 DRAWTEXT(XG=8,ZJL*1.1,'底背离')COLORRED;
 STICKLINE(WDMACD>REF(WDMACD,1) AND WDMACD>0,0,WDMACD,0,0),COLORRED;
 STICKLINE(WDMACD<REF(WDMACD,1) AND WDMACD>0,0,WDMACD,0,0),COLORLIRED;
 STICKLINE(WDMACD>REF(WDMACD,1) AND WDMACD<0,0,WDMACD,0,0),COLORYELLOW;
 STICKLINE(WDMACD<REF(WDMACD,1) AND WDMACD<0,0,WDMACD,0,0),COLORLIBLUE;
 STICKLINE(C> O,ZJH,ZJL,0.01,0),COLORFF66FF;
 STICKLINE(C> O,ZJC,ZJO,2.1,0),COLORAA00AA;
 STICKLINE(C> O,ZJC,ZJO,1.9,0),COLORCC11CC;
 STICKLINE(C> O,ZJC,ZJO,1.6,0),COLORFF22FF;
 STICKLINE(C> O,ZJC,ZJO,1.2,0),COLORFF44FF;
 STICKLINE(C> O,ZJC,ZJO,0.7,0),COLORFF66FF;
 STICKLINE(C> O,ZJC,ZJO,0.2,0),COLORFF99FF;
 STICKLINE(C<=O OR C<REF(C,1),ZJH,ZJL,0.01,0),COLORGREEN;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,2.1,0),COLOR005500;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,1.9,0),COLOR007700;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,1.6,0),COLOR009900;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,1.2,0),COLOR00BB00;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,0.7,0),COLOR00DD00;
 STICKLINE(C<=O OR C<REF(C,1),ZJO,ZJC,0.2,0),COLOR44FF00;
 ZTB:=(C-REF(C,1))/REF(C,1)*100>9.91&&(C-REF(C,1))/REF(C,1)*100<10.6;
 DRAWTEXT(ZTB,IF(ZJC<0,ZJC*0.9,ZJC*1.1),'涨停板')COLORYELLOW;
 STICKLINE(C=H,ZJH,ZJL,0.0,0),COLORYELLOW;
 STICKLINE(ZTB,ZJC,ZJO,2.1,0),COLOR006666;
 STICKLINE(ZTB,ZJC,ZJO,1.9,0),COLOR008888;
 STICKLINE(ZTB,ZJC,ZJO,1.6,0),COLOR00AAAA;
 STICKLINE(ZTB,ZJC,ZJO,1.2,0),COLOR00CCCC;
 STICKLINE(ZTB,ZJC,ZJO,0.7,0),COLOR00EEEE;
 STICKLINE(ZTB,ZJC,ZJO,0.2,0),COLOR33FFFF;
 DTB:=(C-REF(C,1))/REF(C,1)*100<-9.9&&(C-REF(C,1))/REF(C,1)*100>-10.6;
 DRAWTEXT(DTB,IF(ZJC>0,ZJC*0.9,ZJC*1.1),'跌停板')COLORFF8800;
 STICKLINE(DTB,ZJO,ZJC,2.1,0),COLORFF0000;{蓝色}
STICKLINE(DTB,ZJO,ZJC,1.9,0),COLORFF2200;
 STICKLINE(DTB,ZJO,ZJC,1.6,0),COLORFF4400;
 STICKLINE(DTB,ZJO,ZJC,1.2,0),COLORFF6600;
 STICKLINE(DTB,ZJO,ZJC,0.7,0),COLORFF8800;
 STICKLINE(DTB,ZJO,ZJC,0.2,0),COLORFFAA00;
 WZ:=HHV(WDDIF*2,200);
 DRAWTEXT(CURRBARSCOUNT=40+1,WZ*1.25,'-'),COLORYELLOW;
 DRAWTEXT(CURRBARSCOUNT=40+1,WZ*1.20,'【操作要领】'),COLORYELLOW;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*1.10,'0轴以上,与主图相比,阴K线若高收,后市下跌。')COLOR44FF00;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*1.00,'0轴以上,与主图相比,阳K线若下挫,后市下跌。')COLOR44FF00;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*0.90,'0轴以上,股价创新高但MACD柱状线缩短,后市下调或下跌。')COLOR44FF00;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*0.80,'0轴以下,与主图相比,阴K线若上移,后市上涨。'),COLORFF66FF;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*0.70,'0轴以下,与主图相比,阳K线若下挫,后市上涨。'),COLORFF66FF;
 DRAWTEXT(CURRBARSCOUNT=40,WZ*0.60,'0轴以下,股价创新低但MACD柱状线缩短或翻红,后市上涨。'),COLORFF66FF;

扫一扫,分享到微信朋友圈