通达信自在买卖-对MACD再优化副图公式
通达信自在买卖-对MACD再优化副图公式
MACD指标的构造起点是股价的平滑移动平均线EMA,所以,决定了它的强势性与稳定性的特点,同时它克服了均线频繁发出假性信号的缺陷,使得它对中长期趋势的把握准确率较大,深受趋势买家的喜爱。既然它有无可挑剔的稳定性,那么,它的滞后性也随之而来。因此,对这个问题的解决方法只有仰仗指标参数的优化来搞定了。
MACD指标一般不适合短线和超短线的股友使用,也不适合在盘整行情下使用。通常来说,在短线和超短线交易中需要你对股价的短期波动灰常敏感。而MACD指标的滞后性对股价短期波动太难及时地给予反映,因此,MACD指标就十分不适合短线客操作了。此外,在盘整行情中,它一般会围绕0轴上下运动,频繁发出金死叉等交易信号,而,这些信号往往大多数均属无效信号。
本指标在前不久制作的云制MACD基础上又多加入一些理念及思路,可以给各位做一抛砖引玉
源码
DIFF1:EMA(C,13) - EMA(C,34),COLOR00FFFF ;
DEA1:EMA(EMA(C,13) - EMA(C,34),12) ;
IF(EMA(C,13) - EMA(C,34) >= EMA(EMA(C,13) - EMA(C,34) ,12),EMA(C,13) - EMA(C,34) ,DRAWNULL),COLORRED;
IF((EMA(C,13) - EMA(C,34) - EMA(EMA(C,13) - EMA(C,34) ,12) ) * 1000/EMA(C,15) > 0 AND (EMA(C,13) - EMA(C,34) - EMA(EMA(C,13) - EMA(C,34) ,12) ) * 1000/EMA(C,15) < 1.85,EMA(C,13) - EMA(C,34),DRAWNULL),COLORGREEN;
IF(EMA(C,13) - EMA(C,34) < EMA(EMA(C,13) - EMA(C,34) ,12) OR EMA(C,13) - EMA(C,34) > EMA(EMA(C,13) - EMA(C,34) ,12) AND REF(EMA(C,13) - EMA(C,34) ,1) < REF(EMA(EMA(C,13) - EMA(C,34) ,12) ,1),EMA(C,13) - EMA(C,34) ,DRAWNULL),COLOR00FF00;
DRAWBAND(DIFF1,RGB(64,0,64),DEA1,RGB(57,58,66));
DIFF:=EMA(C,13)-EMA(C,21),NODRAW;
DEA:=EMA(DIFF,5);
MACD:=2*(DIFF-DEA);
回吐:IF(DEA>0,DEA,0),COLORFFFFFF,NODRAW;
回补:IF(DEA<0,DEA,0),COLOR00FFFF,NODRAW;
持币:IF(DIFF<0,DIFF,0),COLORFF0000,NODRAW;
持股:IF(DIFF>0,DIFF,0),COLOR0000FF,NODRAW;
ZG:=HHVBARS(DIFF,89)+1;
HH:REF(DIFF,BARSSINCE(BACKSET(ISLASTBAR,ZG))),COLORAAAA77,LINETHICK2;
ZD:=LLVBARS(DIFF,89)+1;
LL:REF(DIFF,BARSSINCE(BACKSET(ISLASTBAR,ZD))),COLORAA77AA,LINETHICK2;
DRAWNUMBER(ISLASTBAR,HH+0.03,ZG),COLOR00AA00;
DRAWNUMBER(ISLASTBAR,LL+0.05,ZD),COLOR0000AA;
DRAWNUMBER(CURRBARSCOUNT=11 AND DIFF,HH+0.03,HH);
DRAWNUMBER(CURRBARSCOUNT=11 AND DIFF,LL+0.05,LL);
STICKLINE((DEA>0),0,DEA,2.5,0),COLORAAAAAA;
STICKLINE((DEA>0),0,DEA,1.8,0),COLORCCCCCC;
STICKLINE((DEA>0),0,DEA,1,0),COLORDDDDDD;
STICKLINE((DEA>0),0,DEA,0.2,0),COLORFFFFFF;
STICKLINE(DEA<0,0,DEA,2.5,0),COLOR0064AA;
STICKLINE(DEA<0,0,DEA,1.8,0),COLOR0093CC;
STICKLINE(DEA<0,0,DEA,1,0),COLOR00C2DD;
STICKLINE(DEA<0,0,DEA,0.2,0),COLOR00FFFF;
STICKLINE(DIFF<0,0,DIFF,2.5,0),COLORAA1100;
STICKLINE(DIFF<0,0,DIFF,1.8,0),COLORAA3300;
STICKLINE(DIFF<0,0,DIFF,1,0),COLORAA5500;
STICKLINE(DIFF<0,0,DIFF,0.2,0),COLORAA7700;
STICKLINE(DIFF>0,0,DIFF,2.5,0),COLOR0000AA;
STICKLINE(DIFF>0,0,DIFF,1.8,0),COLOR0000CC;
STICKLINE(DIFF>0,0,DIFF,1,0),COLOR0000DD;
STICKLINE(DIFF>0,0,DIFF,0.2,0),COLOR0000FF;
DRAWTEXT(REF(DIFF<0 AND DIFF<DEA,1) AND DIFF<0 AND DIFF>DEA ,DEA-0.1,"回"),COLOR00FFFF;
DRAWTEXT(REF(DIFF<0 AND DIFF<DEA,1) AND DIFF<0 AND DIFF>DEA ,DEA-0.2,"补"),COLOR00FFFF;
DRAWTEXT(CROSS(DIFF>0,0.5) ,DIFF+0.2,"买"),COLOR0000FF;
DRAWTEXT(CROSS(DIFF>0,0.5) ,DIFF+0.1,"入"),COLOR0000FF;
DRAWTEXT(REF(DIFF>0 AND DIFF>DEA,1) AND DIFF>0 AND DIFF<DEA ,DEA+0.2,"回"),COLORFFFFFF;
DRAWTEXT(REF(DIFF>0 AND DIFF>DEA,1) AND DIFF>0 AND DIFF<DEA ,DEA+0.1,"吐"),COLORFFFFFF;
DRAWICON(CROSS(EMA(C,13) - EMA(C,34) >= EMA(EMA(C,13) - EMA(C,34) ,12),0.5),EMA(EMA(C,13) - EMA(C,34) ,12) ,5);
DRAWICON(CROSS(EMA(EMA(C,13) - EMA(C,34) ,12) >=EMA(C,13) - EMA(C,34) ,0.5),EMA(EMA(C,13) - EMA(C,34) ,12) ,6);