九毛八公式指标
公式模块:
求助高手帮助用四背离指标做一个选股公式
N:=60;
K值:="kdj.K";
DD:=C=LLV(C,N);{60日最低点}
DDSJ:=BArslAST(REF(DD,1));{上一低点时间}
DDGJ:=REF(CLOSE,DDSJ+1)>CLOSE;{股价趋势}
kdZB:=REF(K值,DDSJ+1)<K值;{KDJ.K指标趋势}
K底背离:=DDGJ AND KDZB;
GD:=C=HHV(C,N);{60日最高点}
GDSJ:=BARSLAST(REF(GD,1));{上一高点时间}
GDGJ:=REF(CLOSE,GDSJ+1)<CLOSE;{股价趋势}
KGZB:=REF(K值,GDSJ+1)>K值;
K顶背离:=GDGJ AND KGZB;
macd:="MacD.MACD";
MDZB:=REF(MACD,DDSJ+1)<MACD;{MACD指标趋势}
M底背离:=DDGJ AND MDZB;
MGZB:=REF(MACD,GDSJ+1)>MACD;
M顶背离:=GDGJ AND MGZB;
rsi:="RSI.RSI1";
RDZB:=REF(RSI,DDSJ+1)<RSI;{RSI指标趋势}
R底背离:=DDGJ AND RDZB;
RGZB:=REF(RSI,GDSJ+1)>RSI;
R顶背离:=GDGJ AND RGZB;
TYP:=(HIGH + LOW + CLOSE)/3;
cci:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
CDZB:=REF(CCI,DDSJ+1)<CCI;{CCI指标趋势}
C底背离:=DDGJ AND CDZB;
CGZB:=REF(CCI,GDSJ+1)>CCI;
C顶背离:=GDGJ AND CGZB;
REFLINE: -5,15,30,colorblack;
DRAWTEXT(ISLASTBAR,29,'KDJ顶背离'),LINETHICK2,colorred;
DRAWTEXT(K顶背离,IF(ISLASTBAR,27.5,29),'(×)'),LINETHICK2,colorred;
DRAWTEXT(ISLASTBAR,26,'MACD顶背离'),LINETHICK2,colormagenta;
DRAWTEXT(M顶背离,(ISLASTBAR,24.5,26),'(×)'),LINETHICK2,colormagenta,;
DRAWTEXT(ISLASTBAR,22.1,'RSI顶背离'),LINETHICK2,colorblue;
DRAWTEXT(R顶背离,(ISLASTBAR,20.5,22.1),'(×)'),LINETHICK2,colorblue;
DRAWTEXT(ISLASTBAR,18.1,'CCI顶背离'),LINETHICK2,colorgreen;
DRAWTEXT(C顶背离,(ISLASTBAR,16.6,18.1),'(×)'),LINETHICK2,colorgreen,;
DRAWTEXT(ISLASTBAR,14.2,'CCI底背离'),LINETHICK2,colorgreen;
DRAWTEXT(C底背离,IF(ISLASTBAR,12,14.2),'(√)'),LINETHICK2,colorgreen;
DRAWTEXT(ISLASTBAR,10,'RSI底背离'),LINETHICK2,colorblue;
DRAWTEXT(R底背离,IF(ISLASTBAR,8.5,10),'(√)'),LINETHICK2,colorblue;
DRAWTEXT(ISLASTBAR,6,'MACD底背离'),LINETHICK2,colormagenta;
DRAWTEXT(M底背离,IF(ISLASTBAR,4.5,6),'(√)'),LINETHICK2,colormagenta;
DRAWTEXT(ISLASTBAR,3,'KDJ底背离'),LINETHICK2,colorred;
DRAWTEXT(K底背离,IF(ISLASTBAR,1.5,3),'(√)'),LINETHICK2,colorred; n:=60;
k值:="kdj.k";
dd:=c=llv(c,n);{60日最低点}
ddsj:=barslast(ref(dd,1));{上一低点时间}
ddgj:=ref(close,ddsj+1)>close;{股价趋势}
kdzb:=ref(k值,ddsj+1)<k值;{kdj.k指标趋势}
k底背离:=ddgj and kdzb;
gd:=c=hhv(c,n);{60日最高点}
gdsj:=barslast(ref(gd,1));{上一高点时间}
gdgj:=ref(close,gdsj+1)<close;{股价趋势}
kgzb:=ref(k值,gdsj+1)>k值;
k顶背离:=gdgj and kgzb;
macd:="macd.macd";
mdzb:=ref(macd,ddsj+1)<macd;{macd指标趋势}
m底背离:=ddgj and mdzb;
mgzb:=ref(macd,gdsj+1)>macd;
m顶背离:=gdgj and mgzb;
rsi:="rsi.rsi1";
rdzb:=ref(rsi,ddsj+1)<rsi;{rsi指标趋势}
r底背离:=ddgj and rdzb;
rgzb:=ref(rsi,gdsj+1)>rsi;
r顶背离:=gdgj and rgzb;
typ:=(high + low + close)/3;
cci:=(typ-ma(typ,n))/(0.015*avedev(typ,n));
cdzb:=ref(cci,ddsj+1)<cci;{cci指标趋势}
c底背离:=ddgj and cdzb;
cgzb:=ref(cci,gdsj+1)>cci;
c顶背离:=gdgj and cgzb;
底背离四合一:k底背离 and m底背离 and r底背离 and c底背离;
{
顶背离四合一, 则将最后一行替换成:
顶背离四合一:k顶背离 and m顶背离 and r顶背离 and c顶背离;
}