编写要求:
{参数:n 9 1 100 p1 3 2 40 p2 3 2 40 }
源码:
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,P1,1);
D:SMA(K,P2,1);
J:3*K-2*D;
{kdj日周月金叉死叉}
周K:="KDJ.K#WEEK"(9,3,3);
周D:="KDJ.D#WEEK"(9,3,3);
周J:="KDJ.J#WEEK"(9,3,3);
月K:="KDJ.K#MONTH"(9,3,3);
月D:="KDJ.D#MONTH"(9,3,3);
月J:="KDJ.J#MONTH"(9,3,3);
月金叉:=cross(月K,月D);
周金叉:=cross(周K,周D);
日金叉:=FILTER(cross(K,D) and K<20,4);
drawtext(月金叉,月D-2,'★'),ALIGN0,color0022ee;
DRAWTEXT(月金叉,月D-2,'KD月金叉'),coloryellow;
drawtext(周金叉,周D,'★'),ALIGN2,color0022ee;
DRAWTEXT(周金叉,周D,' KD周金叉'),colorgreen;
DRAWICON(日金叉,K,1),align2;
DRAWTEXT(日金叉,D-6,'低位金叉'),color00CCCC;
DRAWTEXT(CROSS(周D,周K),周D*1.2,'KD周死叉'),COLOR00DDBB;
DRAWTEXT(CROSS(月D,月K),月D,'KD月死叉'),COLORFFFFFF;
KDB:=BARSLAST(ref(cross(k,d),1));
KDDB:=ref(close,KDB+1)>close and ref(k,KDB+1)
解答:
?月周日KDJ同显,通达信版。看是否你想要的。
月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)
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)
DRAWTEXT(FILTER(B2>0,5),0.80,'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)
DRAWTEXT(FILTER(B3>0,5),0.25,'RSI底背离'),COLORWHITE;
2,COLORRED;
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)
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)
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)
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;
50,COLORFFA2AF;
80,COLORFFA2AF,POINTDOT;
100,COLORFFA2AF;
Copyright 2018- www.dyjian.com/ 大宇股票知识网 海口美兰韩哲棚百货商行 版权所有 琼ICP备2023001966号
免责声名:本站所发表的内容仅用于学术交流和学习,内容所带来的一切后果均与本站无关。若您发现本站存在您非授权的原创作品,请第一时间联系本站删除!