{参数:n9 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) k and cross(k,d);
K底背:=if(FILTER(KDDB 0,5),1,0);
DRAWTEXT(K底背=1,D*0.98,'底背离'),COLORDDDDDD;
KDD:=BARSLAST(ref(cross(d,k),1));
K顶背:=ref(close,KDD+1) close and ref(k,KDD+1) k and cross(d,k);
DRAWTEXT(FILTER(K顶背 0,5),D+8,'顶背离'),COLORFFAA22;