通达信指RSI CCI KD 三指标 公式 源码 分享
TYP := (HIGH + LOW + CLOSE)/3;
CC1:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
DRAWTEXT(ISLASTBAR AND CC1,CC1,'CC1'),COLORFF00FF;
DRAWBAND(CC1,RGB(2,255,2),-100,RGB(255,255,0));
DRAWBAND(100,RGB(0,0,0),-100,RGB(0,0,0));
CC2:(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),COLORFF00FF;
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI:(RSI1-50)*5,LINETHICK2,COLORFFFFFF;
DRAWTEXT(ISLASTBAR AND RSI>REF(RSI,1),RSI,' ↑RSI'),COLORFFFFFF;
DRAWTEXT(ISLASTBAR AND RSI<REF(RSI,1),RSI,' ↓RSI'),COLORFFFFFF;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
K1:(K-50)*5,COLORFF9F00;
DRAWTEXT(ISLASTBAR AND K1>REF(K1,1),K1,' ▲K'),COLORFFFF00;
DRAWTEXT(ISLASTBAR AND K1<REF(K1,1),K1,' ▼K'),COLORFFFF00;
0;
100,POINTDOT;
-100,POINTDOT;
-200,COLORFFFF00;
200,COLORFFFF00;
C1:=SMA(CC1,3,1);
C2:=SMA(C1,3,1);
C3:=3*C1-2*C2;
CB1:=EMA(C3,5);
CB2:=REF(CB1,1);
R1:=SMA(RSI,3,1);
D1:=SMA(R1,3,1);
J1:=3*R1-2*D1;
RR1:=EMA(J1,5);
RR2:=REF(RR1,1);
RR:=RR1>RR2;
K2:=SMA(K1,3,1);
D2:=SMA(K2,3,1);
J2:=3*K2-2*D2;
BB1:=EMA(J2,5);
BB2:=REF(BB1,1);
买入:RR AND NOT(REF(RR,1)) AND (RR1<-100 AND BB1<-100) AND CB1<-100,NODRAW;
DRAWICON(买入,-200,1);
卖出:REF(RR,1)=1 AND NOT(RR) AND CB1>100,NODRAW;
DRAWICON(卖出,200,2);
来函数检测结果如下:
该公式没有未来函数
解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式
TYP := (最高价 + 最低价 + 收盘价)/3
CC1赋值:(TYP-TYP的14日简单移动平均)/(0.015*AVEDEV(TYP,14))
当满足条件ISLASTBAR AND CC1时,在CC1和'CC1'位置书写文字
DRAWBAND(CC1,RGB(2,255,2),-100,RGB(255,255,0))
DRAWBAND(100,RGB(0,0,0),-100,RGB(0,0,0))
输出
CC2:(TYP-TYP的14日简单移动平均)/(0.015*AVEDEV(TYP,14)),COLORFF00FF
LC := 1日前的收盘价
RSI1赋值:SMA(收盘价-LC和0较大值,6,1)/SMA(收盘价-LC的绝对值,6,1)*100
输出
RSI:(RSI1-50)*5, 线宽为2,COLORFFFFFF
DRAWTEXT(ISLASTBAR AND RSI>1日前的RSI,RSI,' ↑RSI'),COLORFFFFFF
DRAWTEXT(ISLASTBAR AND RSI<1日前的RSI,RSI,' ↓RSI'),COLORFFFFFF
RSV赋值:(收盘价-9日内最低价最低值)/(9日内最高价最高值-9日内最低价最低值)*100
RSV的3日[1日权重]移动平均
K1:(K-50)*5,COLORFF9F00
DRAWTEXT(ISLASTBAR AND K1>1日前的K1,K1,' ▲K'),COLORFFFF00
DRAWTEXT(ISLASTBAR AND K1<1日前的K1,K1,' ▼K'),COLORFFFF00
0
100,POINTDOT
-100,POINTDOT
-200,COLORFFFF00
200,COLORFFFF00
CC1的3日[1日权重]移动平均
C1的3日[1日权重]移动平均
C3赋值:3*C1-2*C2
CB1赋值:C3的5日指数移动平均
CB2赋值:1日前的CB1
RSI的3日[1日权重]移动平均
R1的3日[1日权重]移动平均
J1赋值:3*R1-2*D1
RR1赋值:J1的5日指数移动平均
RR2赋值:1日前的RR1
RR赋值:RR1>RR2
K1的3日[1日权重]移动平均
K2的3日[1日权重]移动平均
J2赋值:3*K2-2*D2
BB1赋值:J2的5日指数移动平均
BB2赋值:1日前的BB1
输出
买入:RR AND NOT(1日前的RR) AND (RR1<-100 AND BB1<-100) AND CB1<-100,NODRAW
当满足条件买入时,在-200和1之间画图标
输出
卖出:1日前的RR=1 AND NOT(RR) AND CB1>100,NODRAW
当满足条件卖出时,在200和2之间画图标