通达信精准背离
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1)COLORCYAN;
D:SMA(K,3,1)COLORYELLOW;
J:3*K-2*D,COLORMAGENTA;
{K值,D值,J值的背离}
{------------------------------------------------------------------------------}
N:=5;
J底背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.J,N)=LLV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=LLV(KDJ.J,N+1),1))+1)>C AND
REF(KDJ.J,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.J,N)=LLV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=LLV(KDJ.J,N+1),1))+1)<KDJ.J AND
FILTER(BACKSET(REF(KDJ.J,N)=LLV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=LLV(KDJ.J,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.J,N)=LLV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=LLV(KDJ.J,N+1),KDJ.J,FILTER(J底背>0,5),KDJ.J,0),
COLORWHITE,DOTLINE;
DRAWTEXT(J底背,KDJ.J,'J底背'),COLORLIMAGENTA;
J顶背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.J,N)=HHV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=HHV(KDJ.J,N+1),1))+1)<C AND
REF(KDJ.J,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.J,N)=HHV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=HHV(KDJ.J,N+1),1))+1)>KDJ.J AND
FILTER(BACKSET(REF(KDJ.J,N)=HHV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=HHV(KDJ.J,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.J,N)=HHV(KDJ.J,2*N+1),N+1),N) AND KDJ.J=HHV(KDJ.J,N+1),KDJ.J,FILTER(J顶背>0,5),KDJ.J,0),
COLORGREEN,DOTLINE;
DRAWTEXT(J顶背,KDJ.J,'J顶背'),COLORMAGENTA;
{------------------------------------------------------------------------------}
K底背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.K,N)=LLV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=LLV(KDJ.K,N+1),1))+1)>C AND
REF(KDJ.K,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.K,N)=LLV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=LLV(KDJ.K,N+1),1))+1)<KDJ.K AND
FILTER(BACKSET(REF(KDJ.K,N)=LLV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=LLV(KDJ.K,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.K,N)=LLV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=LLV(KDJ.K,N+1),KDJ.K,FILTER(K底背>0,5),KDJ.K,0),
COLORWHITE,DOTLINE;
DRAWTEXT(K底背,KDJ.K,'K底背'),COLORWHITE;
K顶背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.K,N)=HHV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=HHV(KDJ.K,N+1),1))+1)<C AND
REF(KDJ.K,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.K,N)=HHV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=HHV(KDJ.K,N+1),1))+1)>KDJ.K AND
FILTER(BACKSET(REF(KDJ.K,N)=HHV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=HHV(KDJ.K,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.K,N)=HHV(KDJ.K,2*N+1),N+1),N) AND KDJ.K=HHV(KDJ.K,N+1),KDJ.K,FILTER(K顶背>0,5),KDJ.K,0),
COLORGREEN,DOTLINE;
DRAWTEXT(K顶背,KDJ.K,'K顶背'),COLORLIBLUE;
{------------------------------------------------------------------------------}
D底背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.D,N)=LLV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=LLV(KDJ.D,N+1),1))+1)>C AND
REF(KDJ.D,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.D,N)=LLV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=LLV(KDJ.D,N+1),1))+1)<KDJ.D AND
FILTER(BACKSET(REF(KDJ.D,N)=LLV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=LLV(KDJ.D,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.D,N)=LLV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=LLV(KDJ.D,N+1),KDJ.D,FILTER(D底背>0,5),KDJ.D,0),
COLORWHITE,DOTLINE;
DRAWTEXT(D底背,KDJ.D,'D底背'),COLORYELLOW;
D顶背:REF(C,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.D,N)=HHV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=HHV(KDJ.D,N+1),1))+1)<C AND
REF(KDJ.D,BARSLAST(REF(FILTER(BACKSET(REF(KDJ.D,N)=HHV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=HHV(KDJ.D,N+1),1))+1)>KDJ.D AND
FILTER(BACKSET(REF(KDJ.D,N)=HHV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=HHV(KDJ.D,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(KDJ.D,N)=HHV(KDJ.D,2*N+1),N+1),N) AND KDJ.D=HHV(KDJ.D,N+1),KDJ.D,FILTER(D顶背>0,5),KDJ.D,0),
COLORGREEN,DOTLINE;
DRAWTEXT(D顶背,KDJ.D,'D顶背'),COLOR4080FF;
A2:=BARSLAST(REF(CROSS(K,D),1));
{股票指标网}
B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);
DRAWTEXT((B2>0),-10,'_金叉底背'),COLORLIRED;
STICKLINE((B2>0),-10,50,0,-1)COLORLIRED;
C2:=BARSLAST(REF(CROSS(D,K),1));
D2:=REF(C,C2+1)<C AND REF(K,C2+1)>K AND CROSS(D,K);
DRAWTEXT((D2>0),110,'_死叉顶背'),COLORLICYAN;
STICKLINE((D2>0),110,50,0,-1)COLORLICYAN;
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
RSV赋值:(收盘价-9日内最低价最低值)/(9日内最高价最高值-9日内最低价最低值)*100
RSV的3日[1日权重]移动平均
K的3日[1日权重]移动平均
输出J:3*K-2*D,画洋红色
{K值,D值,J值的背离}
{------------------------------------------------------------------------------}
N:=5
J底背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.J,N距今天数=2*N+1日内KDJ.J最低值,N+1),N) AND KDJ.J=N+1日内KDJ.J最低值,1))+1)>C AND
REF(KDJ.J,上次REF(FILTER(BACKSET(REF(KDJ.J,N距今天数=2*N+1日内KDJ.J最低值,N+1),N) AND KDJ.J=N+1日内KDJ.J最低值,1))+1)
DRAWLINE(FILTER(BACKSET(N日前的KDJ.J=2*N+1日内KDJ.J最低值,N+1),N) AND KDJ.J=N+1日内KDJ.J最低值,KDJ.J,FILTER(J底背>0,5),KDJ.J,0),
画白色,DOTLINE
当满足条件J底背时,在KDJ.J和'J底背'位置书写文字
J顶背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.J,N距今天数=2*N+1日内KDJ.J最高值,N+1),N) AND KDJ.J=N+1日内KDJ.J最高值,1))+1)KDJ.J AND
FILTER(BACKSET(REF(KDJ.J,N)=2*N+1日内KDJ.J最高值,N+1),N) AND KDJ.J=N+1日内KDJ.J最高值,画绿色,NODRAW
DRAWLINE(FILTER(BACKSET(N日前的KDJ.J=2*N+1日内KDJ.J最高值,N+1),N) AND KDJ.J=N+1日内KDJ.J最高值,KDJ.J,FILTER(J顶背>0,5),KDJ.J,0),
画绿色,DOTLINE
当满足条件J顶背时,在KDJ.J和'J顶背'位置书写文字
{------------------------------------------------------------------------------}
K底背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.K,N距今天数=2*N+1日内KDJ.K最低值,N+1),N) AND KDJ.K=N+1日内KDJ.K最低值,1))+1)>C AND
REF(KDJ.K,上次REF(FILTER(BACKSET(REF(KDJ.K,N距今天数=2*N+1日内KDJ.K最低值,N+1),N) AND KDJ.K=N+1日内KDJ.K最低值,1))+1)
DRAWLINE(FILTER(BACKSET(N日前的KDJ.K=2*N+1日内KDJ.K最低值,N+1),N) AND KDJ.K=N+1日内KDJ.K最低值,KDJ.K,FILTER(K底背>0,5),KDJ.K,0),
画白色,DOTLINE
当满足条件K底背时,在KDJ.K和'K底背'位置书写文字
K顶背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.K,N距今天数=2*N+1日内KDJ.K最高值,N+1),N) AND KDJ.K=N+1日内KDJ.K最高值,1))+1)KDJ.K AND
FILTER(BACKSET(REF(KDJ.K,N)=2*N+1日内KDJ.K最高值,N+1),N) AND KDJ.K=N+1日内KDJ.K最高值,画绿色,NODRAW
DRAWLINE(FILTER(BACKSET(N日前的KDJ.K=2*N+1日内KDJ.K最高值,N+1),N) AND KDJ.K=N+1日内KDJ.K最高值,KDJ.K,FILTER(K顶背>0,5),KDJ.K,0),
画绿色,DOTLINE
当满足条件K顶背时,在KDJ.K和'K顶背'位置书写文字
{------------------------------------------------------------------------------}
D底背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.D,N距今天数=2*N+1日内KDJ.D最低值,N+1),N) AND KDJ.D=N+1日内KDJ.D最低值,1))+1)>C AND
REF(KDJ.D,上次REF(FILTER(BACKSET(REF(KDJ.D,N距今天数=2*N+1日内KDJ.D最低值,N+1),N) AND KDJ.D=N+1日内KDJ.D最低值,1))+1)
DRAWLINE(FILTER(BACKSET(N日前的KDJ.D=2*N+1日内KDJ.D最低值,N+1),N) AND KDJ.D=N+1日内KDJ.D最低值,KDJ.D,FILTER(D底背>0,5),KDJ.D,0),
画白色,DOTLINE
当满足条件D底背时,在KDJ.D和'D底背'位置书写文字
D顶背:REF(C,上次REF(FILTER(BACKSET(REF(KDJ.D,N距今天数=2*N+1日内KDJ.D最高值,N+1),N) AND KDJ.D=N+1日内KDJ.D最高值,1))+1)KDJ.D AND
FILTER(BACKSET(REF(KDJ.D,N)=2*N+1日内KDJ.D最高值,N+1),N) AND KDJ.D=N+1日内KDJ.D最高值,画绿色,NODRAW
DRAWLINE(FILTER(BACKSET(N日前的KDJ.D=2*N+1日内KDJ.D最高值,N+1),N) AND KDJ.D=N+1日内KDJ.D最高值,KDJ.D,FILTER(D顶背>0,5),KDJ.D,0),
画绿色,DOTLINE
当满足条件D顶背时,在KDJ.D和'D顶背'位置书写文字
A2赋值:上次1日前的K上穿D距今天数
{股票指标网}
B2赋值:A2+1日前的C>C AND A2+1日前的K
DRAWTEXT((B2>0),-10,'_金叉底背'),COLORLIRED
STICKLINE((B2>0),-10,50,0,-1)COLORLIRED
C2赋值:上次1日前的D上穿K距今天数
D2:=C2+1日前的CK AND D上穿K
DRAWTEXT((D2>0),110,'_死叉顶背'),COLORLICYAN
STICKLINE((D2>0),110,50,0,-1)COLORLICYAN