「翔博精选指标」CMACD(通达信公式 副图 源码 测试图)
2021-12-21原创 编 辑:翔博软件
CMACD}
{CMACD 参数:N=14 SHORT=12 LONG=26 M=9}
TYP := (HIGH + LOW + CLOSE)/3;
CCI:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
DIFF : EMA(CCI,SHORT) - EMA(CCI,LONG); DEA : EMA(DIFF,M);MACD :
2*(DIFF-DEA), COLORSTICK;
BV:=SUM(MACD,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);
面积:SMACD,COLORRED,NODRAW ;
MACDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0000EE;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0000FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0033FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR3355FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR6677FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR8888FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR9999FF;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR0099CC;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00AADD;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00BBDD;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00CCEE;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00DDEE;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00EEFF;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00FFFF;
STICKLINE(MACDLX<0,MACD,0,1,0),COLOR990000;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORAA2200;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORBB4400;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORCC7700;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORDD9900;
STICKLINE(MACDLX<0,MACD,0,1,0),COLOREEBB00;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORFFCC00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR005500;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR007700;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR009900;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00BB00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00DD00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00EE00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00FF00;
VAR3:=IF(MACD>0,HHV(ABS(MACD),BC),LLV(MACD,BC));
VAR4:=(MACD)/20;{图形比例缩小1/20,可修改}
{CMACD 参数:N=14 SHORT=12 LONG=26 M=9}
TYP := (HIGH + LOW + CLOSE)/3;
CCI:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
DIFF : EMA(CCI,SHORT) - EMA(CCI,LONG); DEA : EMA(DIFF,M);MACD :
2*(DIFF-DEA), COLORSTICK;
BV:=SUM(MACD,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);
面积:SMACD,COLORRED,NODRAW ;
MACDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0000EE;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0000FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR0033FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR3355FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR6677FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR8888FF;
STICKLINE(MACDHS>0,0,MACD,1,0),COLOR9999FF;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR0099CC;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00AADD;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00BBDD;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00CCEE;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00DDEE;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00EEFF;
STICKLINE(MACDHX>0,0,MACD,1,0),COLOR00FFFF;
STICKLINE(MACDLX<0,MACD,0,1,0),COLOR990000;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORAA2200;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORBB4400;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORCC7700;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORDD9900;
STICKLINE(MACDLX<0,MACD,0,1,0),COLOREEBB00;
STICKLINE(MACDLX<0,MACD,0,1,0),COLORFFCC00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR005500;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR007700;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR009900;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00BB00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00DD00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00EE00;
STICKLINE(MACDLS<0,MACD,0,1,0),COLOR00FF00;
VAR3:=IF(MACD>0,HHV(ABS(MACD),BC),LLV(MACD,BC));
VAR4:=(MACD)/20;{图形比例缩小1/20,可修改}
VAR5:=SMACD;