通达信共振指标成功率80%
月K:="KDJ.K"(89,3,3),COLOR00FF00;
月D:="KDJ.D"(89,3,3),COLOR00FF00,LINETHICK2;
周K:="KDJ.K"(27,3,3),COLORRED;
周D:="KDJ.D"(27,3,3),COLORRED,LINETHICK2;
日K:="KD.K"(5,3,3),COLORWHITE;
日D:="KD.D"(5,3,3),COLORWHITE,LINETHICK2;
日金叉:IF(CROSS(日K,日D),50,0),COLORFFFFFF;
DRAWTEXT(日金叉,50,'日叉'),COLORFFFFFF;
周金叉:IF(CROSS(周K,周D),30,0),COLORRED;
DRAWTEXT(周金叉,30,'周叉'),COLORRED;
月金叉:IF(CROSS(月K,月D),20,0),COLOR0080FF;
DRAWTEXT(月金叉,20,'月叉'),COLORYELLOW;
{KD在30以下多次金叉}
JM:=CROSS("KDJ.K"(5,3,3),"KDJ.D"(5,3,3));
JMCOUNT:=COUNT(JM,BARSLAST("KDJ.D"(5,3,3)>=30));
JMTJ:=28*("KDJ.D"(5,3,3)<30 AND COUNT(JMCOUNT=1,21)=1);
DRAWTEXT (JMTJ,70,'①'),COLORWHITE;
JMTJ2:=28*("KDJ.D"(5,3,3)<30 AND COUNT(JMCOUNT=2,21)=1);
DRAWTEXT (JMTJ2,70,'②'),COLORYELLOW;
JMTJ3:=28*("KDJ.D"(5,3,3)<30 AND COUNT(JMCOUNT=3,21)=1);
DRAWTEXT (JMTJ3,70,'③'),COLORYELLOW;
JMTJ4:=28*("KDJ.D"(5,3,3)<30 AND COUNT(JMCOUNT=4,21)=1);
DRAWTEXT (JMTJ4,70,'④'),COLORYELLOW;
JMTJ5:=28*("KDJ.D"(5,3,3)<30 AND COUNT(JMCOUNT=5,21)=1);
DRAWTEXT (JMTJ5,70,'⑤'),COLORYELLOW;
0,COLORYELLOW;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
MACD底背离:=STICKLINE(FILTER(B1>0,5),0,0.75,3,0),COLORGREEN;
DRAWTEXT(FILTER(B1>0,5),0.57,'MACD底背离'),COLORGREEN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);
KDJ底背离:=STICKLINE(FILTER(B2>0,5),0,1,3,0),COLORYELLOW;
DRAWTEXT(FILTER(B2>0,5),0.89,'KDJ底背离'),COLORYELLOW;
LC :=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
RSI底背离:STICKLINE(FILTER(B3>0,5),0,0.5,3,0),COLORWHITE;
DRAWTEXT(FILTER(B3>0,5),0.25,'RSI底背离'),COLORWHITE;
2,COLORRED;
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
MACD顶背离:STICKLINE(FILTER(D1>0,5),2,1.25,3,0),COLOR0066FF;
DRAWTEXT(FILTER(D1>0,5),1.47,'MACD顶背离'),COLOR0066FF;
C2:=BARSLAST(REF(CROSS(D,K),1));D2:=REF(C,C2+1)<C AND REF(K,C2+1)>K AND CROSS(D,K);
KDJ顶背离:STICKLINE(FILTER(D2>0,5),2,1,3,0),COLORRED;
DRAWTEXT(FILTER(D2>0,5),1.2,'KDJ顶背离'),COLORRED;
C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:=REF(C,C3+1)<C AND REF(RSI1,C3+1)>RSI1 AND CROSS(RSI2,RSI1);
RSI顶背离:STICKLINE(FILTER(D3>0,5),2,1.5,3,0),COLORFF00FF;
DRAWTEXT(FILTER(D3>0,5),1.75,'RSI顶背离'),COLORFF00FF;
0,COLORFFA2AF;
20,COLORFFA2AF,POINTDOT;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
月K赋值:"KDJ.K"(89,3,3),COLOR00FF00
月D赋值:"KDJ.D"(89,3,3),COLOR00FF00, 线宽为2
周K赋值:"KDJ.K"(27,3,3),画红色
周D赋值:"KDJ.D"(27,3,3),画红色, 线宽为2
日K赋值:"KD.K"(5,3,3),画白色
日D赋值:"KD.D"(5,3,3),画白色, 线宽为2
输出
日金叉:IF(日K上穿日D,50,0),COLORFFFFFF
当满足条件日金叉时,在50和'日叉'位置书写文字
输出
周金叉:IF(周K上穿周D,30,0),画红色
当满足条件周金叉时,在30和'周叉'位置书写文字
输出
月金叉:IF(月K上穿月D,20,0),COLOR0080FF
当满足条件月金叉时,在20和'月叉'位置书写文字
{KD在30以下多次金叉}
JM赋值:CROSS("KDJ.K"(5,3,3),"KDJ.D"(5,3,3))
JMCOUNT赋值:COUNT(JM,上次"KDJ.D"(5,3,3距今天数>=30))
JMTJ赋值:28*("KDJ.D"(5,3,3)<30 AND 统计21日满足JM=1的天数=1)
DRAWTEXT (JMTJ,70,'①'),画白色
JMTJ2:=28*("KDJ.D"(5,3,3)<30 AND 统计21日满足JM=2的天数=1)
DRAWTEXT (JMTJ2,70,'②'),画黄色
JMTJ3:=28*("KDJ.D"(5,3,3)<30 AND 统计21日满足JM=3的天数=1)
DRAWTEXT (JMTJ3,70,'③'),画黄色
JMTJ4:=28*("KDJ.D"(5,3,3)<30 AND 统计21日满足JM=4的天数=1)
DRAWTEXT (JMTJ4,70,'④'),画黄色
JMTJ5:=28*("KDJ.D"(5,3,3)<30 AND 统计21日满足JM=5的天数=1)
DRAWTEXT (JMTJ5,70,'⑤'),画黄色
0,画黄色
DIFF赋值:收盘价的12日指数移动平均-收盘价的26日指数移动平均
DEA赋值:DIFF的9日指数移动平均
MACD赋值:2*(DIFF-DEA)
A1赋值:上次1日前的DIFF上穿DEA距今天数
B1赋值:A1+1日前的C>C AND A1+1日前的DIFF
MACD底背离:=STICKLINE(B1>0的5过滤,0,0.75,3,0),画绿色
DRAWTEXT(B1>0的5过滤,0.57,'MACD底背离'),画绿色
RSV赋值:(收盘价-9日内最低价最低值)/(9日内最高价最高值-9日内最低价最低值)*100
RSV的3日[1日权重]移动平均
K的3日[1日权重]移动平均
A2赋值:上次1日前的K上穿D距今天数
B2赋值:A2+1日前的C>C AND A2+1日前的K
KDJ底背离:=STICKLINE(B2>0的5过滤,0,1,3,0),画黄色
DRAWTEXT(B2>0的5过滤,0.89,'KDJ底背离'),画黄色
LC :=1日前的收盘价
RSI1赋值:SMA(收盘价-LC和0较大值,6,1)/SMA(收盘价-LC的绝对值,6,1)*100
RSI2赋值:SMA(收盘价-LC和0较大值,12,1)/SMA(收盘价-LC的绝对值,12,1)*100
A3赋值:上次1日前的RSI1上穿RSI2距今天数
B3赋值:A3+1日前的C>C AND A3+1日前的RSI1输出
RSI底背离:STICKLINE(B3>0的5过滤,0,0.5,3,0),画白色
DRAWTEXT(B3>0的5过滤,0.25,'RSI底背离'),画白色
2,画红色
C1赋值:上次1日前的DEA上穿DIFF距今天数
D1:=C1+1日前的CDIFF AND DEA上穿DIFF
MACD顶背离:STICKLINE(D1>0的5过滤,2,1.25,3,0),COLOR0066FF
DRAWTEXT(D1>0的5过滤,1.47,'MACD顶背离'),COLOR0066FF
C2赋值:上次1日前的D上穿K距今天数
D2赋值:C2+1日前的CK AND D上穿K
KDJ顶背离:STICKLINE(D2>0的5过滤,2,1,3,0),画红色
DRAWTEXT(D2>0的5过滤,1.2,'KDJ顶背离'),画红色
C3赋值:上次1日前的RSI2上穿RSI1距今天数
D3:=C3+1日前的CRSI1 AND RSI2上穿RSI1
输出
RSI顶背离:STICKLINE(D3>0的5过滤,2,1.5,3,0),COLORFF00FF
DRAWTEXT(D3>0的5过滤,1.75,'RSI顶背离'),COLORFF00FF
0,COLORFFA2AF
20,COLORFFA2AF,POINTDOT