BOLL三周期指标 通达信公式(附图)

[复制链接]
查看204 | 回复0 | 2021-8-20 19:25:35 | 显示全部楼层 |阅读模式

{周K线}
HH:=AA.H1#WEEK,LINETHICK;
LL:=AA.L1#WEEK,LINETHICK;
CC:=AA.C1#WEEK,LINETHICK;
OO:=AA.O1#WEEK,LINETHICK;
ZQ:=CURRBARSCOUNT<90;{设置日MACD显示周期数为最后90天}
P:=91;{设定从倒数第150根K线开始显示周MACD}
Q:=40;{设定周周MACD显示周期数为40周}
P1:=135;{设定从倒数第135根K线开始显示月MACD}
Q1:=20;{设定月MACD显示周期数为20个月}
P30:=157;
Q30:=20;
ZK:=BOLL.BOLL#WEEK;ZD:=BOLL.UB#WEEK;ZJ:=BOLL.LB#WEEK;
YK:=BOLL.BOLL#MONTH;YD:=BOLL.UB#MONTH;YJ:=BOLL.LB#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(ZK,SU);Z2:=REF(ZD,SU);Z3:=REF(ZJ,SU);
Z11:=REFX(Z1,P);Z22:=REFX(Z2,P);Z33:=REFX(Z3,P);
W2:=KX1<+Q;
C1:=REF(CC,SU);O1:=REF(OO,SU);H1:=REF(HH,SU);L1:=REF(LL,SU);
RC:=REFX(C1,P);RO:=REFX(O1,P);RH:=REFX(H1,P);RL:=REFX(L1,P);
TJ4:=RC>=REF(RC,1); TJ5:=RC<REF(RC,1);
STICKLINE(W2 AND TJ4,RH,RL,0,0),COLOR0080FF;
STICKLINE( W2 AND TJ5,RH,RL,0,0),COLORFF8000;
STICKLINE(W2 AND TJ4,RC,RO,3,0),COLOR0080FF;
STICKLINE( W2 AND TJ5,RC,RO,3,0),COLORFF8000;
周中轨:IF(W2,Z11,DRAWNULL),COLORWHITE;
周上轨:IF(W2,Z22,DRAWNULL),COLORYELLOW,LINETHICK1;
周下轨:IF(W2,Z33,DRAWNULL),COLORMAGENTA;
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(YK,SU1);Y2:=REF(YD,SU1);Y3:=REF(YJ,SU1);
Y11:=REFX(Y1,P1);Y22:=REFX(Y2,P1);Y33:=REFX(Y3,P1);
W22:=KX1<1+Q1;
月中轨:IF(W22,Y11,DRAWNULL),COLORWHITE;
月上轨:IF(W22,Y22,DRAWNULL),COLORYELLOW,LINETHICK1;
月下轨:IF(W22,Y33,DRAWNULL),COLORRED;
{月K线}
HH1:=AA.H1#MONTH,LINETHICK;
LL1:=AA.L1#MONTH,LINETHICK;
CC1:=AA.C1#MONTH,LINETHICK;
OO1:=AA.O1#MONTH,LINETHICK;
C11:=REF(CC1,SU1);O11:=REF(OO1,SU1);H11:=REF(HH1,SU1);L11:=REF(LL1,SU1);
RC1:=REFX(C11,P1);RO1:=REFX(O11,P1);RH1:=REFX(H11,P1);RL1:=REFX(L11,P1);
TJ41:=RC1>=REF(RC1,1); TJ51:=RC1<REF(RC1,1);
STICKLINE(W22 AND TJ41,RH,RL,0,0),COLOR0080FF;
STICKLINE( W22 AND TJ51,RH,RL,0,0),COLORFF8000;
STICKLINE(W22 AND TJ41,RC,RO,3,0),COLOR0080FF;
STICKLINE( W22 AND TJ51,RC,RO,3,0),COLORFF8000;
中:IF(ZQ,BOLL.BOLL,DRAWNULL);
上:IF(ZQ,BOLL.UB,DRAWNULL);
下:IF(ZQ,BOLL.LB,DRAWNULL);
STICKLINE(ZQ AND C<O,H,L,0,0),COLORCYAN;
STICKLINE(ZQ AND C>=O,H,L,0,0),COLORRED;
STICKLINE(ZQ AND C<O,C,O,3,0),COLORCYAN;
STICKLINE(ZQ AND C>=O,C,O,3,1),COLORRED;
DRAWTEXT(KX1=P+Q-2,BOLL.BOLL,'周');
DRAWTEXT(KX1=P1+Q1-2,BOLL.BOLL,'月');

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则