通达信周日MACD指标公式
2021/1/9 18:48:53
ZQ:=CURRBARSCOUNT<55;{设置日MACD显示周期数为最后90天}
P:=61;{设定从倒数第150根K线开始显示周MACD}
Q:=50;{设定周周MACD显示周期数为40周}
P1:=135;{设定从倒数第135根K线开始显示月MACD}
Q1:=20;{设定月MACD显示周期数为20个月}
YDIF:=MACD.DIF#MONTH;
YDEA:=MACD.DEA#MONTH;
ZDIF:=MACD.DIF#WEEK;
ZDEA:=MACD.DEA#WEEK;
ZK:=KDJ.K#WEEK;
ZD:=KDJ.D#WEEK;
ZJ:=KDJ.J#WEEK;
YK:=KDJ.K#MONTH;
YD:=KDJ.D#MONTH;
YJ:=KDJ.J#MONTH;
ZQZ:=TOTALBARSCOUNT;
ZQ1:=BARSCOUNT(C);
KX1:=ZQZ-ZQ1;{周K线显示开始位置按倒数K线数计算}
N1:=KX1;{周K线显示开始位置}
K6:=AA.DT1#WEEK;{周K线周期}
K7:=K6>REF(K6,1);{周K线更后}
K8:=SUM(K7,0);{当前周K线位置}
K9:=CONST(K8)-K8;
ZH:=ISLASTBAR;
SU:=IF(ZH,0,SUMBARS(K7,N1-K9)-1);
Z1:=REF(ZDIF,SU);Z2:=REF(ZDEA,SU);
Z11:=REFX(Z1,P);Z22:=REFX(Z2,P);
W2:=KX1<P+Q;
周DIF:IF(W2,Z11,DRAWNULL),COLORMAGENTA;
周DEA:IF(W2,Z22,DRAWNULL),COLOR0080FF,LINETHICK1;
周MACD:IF(W2,(Z11-Z22)*2,DRAWNULL),COLORSTICK;
KK6:=AA.DT1#MONTH;
KK7:=KK6>REF(KK6,1);
KK8:=SUM(KK7,0);
KK9:=CONST(KK8)-KK8;
SU1:=IF(ZH,0,SUMBARS(KK7,KX1-KK9)-1);
Y1:=REF(YDIF,SU1);Y2:=REF(YDEA,SU1);
Y11:=REFX(Y1,P1);Y22:=REFX(Y2,P1);
W22:=KX1<P1+Q1;
DI:=EMA(CLOSE,12)-EMA(CLOSE,26);
DIF:IF(ZQ,DI,DRAWNULL), COLORWHITE;
DEA:IF(ZQ,EMA(DIF,9),DRAWNULL), COLORYELLOW;
MACD:IF(ZQ,2*(DIF-DEA),DRAWNULL), COLORSTICK;
DRAWTEXT(KX1=P+Q-2,DI,'周');
投 股票网 www.to u18.cn
股市公式下载推荐