DRAWGBK(C 0, RGB(36,36,36),RGB(36,36,36),0,'0',0);
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26),NODRAW;
DEA:=EMA(DIF,9),NODRAW;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,9,3),NODRAW;
D:=SMA(K,9,3),NODRAW;
J:=3*K-2*D,NODRAW;
A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);
STICKLINE(A,65,85,3,0),COLORYELLOW;
STICKLINE(A,20,40,3,0),COLORYELLOW;
DRAWICON(A,80,25);
DRAWICON(A,35,25);
DRAWTEXT(A,80,' ★MACD_KDJ金叉共振'),COLORYELLOW;
低位金叉:=CROSS(DIF,DEA) AND DIF -0.1;
STICKLINE(低位金叉,95,105,3,0),COLORWHITE;
DRAWTEXT(低位金叉,100,' MACD低位金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA =0));
二次金叉:=CROSS(DIF,DEA) AND DEA 0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,115,105,3,0),COLORYELLOW;
DRAWTEXT(二次金叉,110,' MACD二次金叉'),COLORYELLOW;
{}
{DIF:EMA(CLOSE,12) - EMA(CLOSE,26),LINETHICK0;}
{DEA:EMA(DIF,9),LINETHICK0;}
{MACD:2*(DIF-DEA);}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
B1:=REF(C,A1+1) C AND REF(DIF,A1+1) DIF AND CROSS(DIF,DEA);
A2:=BARSLAST(REF(CROSS( KDJ.K (9,3,3), KDJ.D (9,3,3)),1));
B2:=REF(C,A2+1) C AND REF( KDJ.K (9,3,3),A2+1) KDJ.K (9,3,3) AND CROSS
( KDJ.K (9,3,3), KDJ.D (9,3,3));
A3:=BARSLAST(REF(CROSS( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24)),1));
B3:=REF(C,A3+1) C AND REF( RSI.RSI1 (6,12,24),A3+1) RSI.RSI1 (6,12,24) AND CROSS
( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24));
C1:=BARSLAST(REF(CROSS(DEA,DIF),1));
D1:=REF(C,C1+1) C AND REF(DIF,C1+1) DIF AND CROSS(DEA,DIF);
C2:=BARSLAST(REF(CROSS( KDJ.D (9,3,3), KDJ.K (9,3,3)),1));
D2:=REF(C,C2+1) C AND REF( KDJ.K (9,3,3),C2+1) KDJ.K (9,3,3) AND CROSS
( KDJ.D (9,3,3), KDJ.K (9,3,3));
C3:=BARSLAST(REF(CROSS( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24)),1));
D3:=REF(C,C3+1) C AND REF( RSI.RSI1 (6,12,24),C3+1) RSI.RSI1 (6,12,24) AND CROSS
( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24));
STICKLINE(B1 0,85,95,3,0),COLORRED;
DRAWTEXT((B1 0),90,' MACD底背离'),COLORRED;
STICKLINE(D1 0,85,95,3,0),COLORFF8000;
DRAWTEXT((D1 0),90,' MACD顶背离'),COLORFF8000;
STICKLINE(B2 0,-10,0,3,0),COLOR8000FF;
DRAWTEXT((B2 0),-5,' KDJ底背离'),COLOR8000FF;
STICKLINE(D2 0,-10,0,3,0),COLORGREEN;
DRAWTEXT((D2 0),-5,' KDJ顶背离'),COLORGREEN;
STICKLINE(B3 0,-20,-10,3,0),COLORRED;
DRAWTEXT((B3 0),-16,' RSI底背离'),COLORRED;
STICKLINE(D3 0,-20,-10,3,0),COLORCYAN;
DRAWTEXT((D3 0),-16,' RSI顶背离'),COLORCYAN;
{}
日DIF:= MACD.DIF#DAY ,NODRAW;
日DEA:= MACD.DEA#DAY ,NODRAW;
日死叉:STICKLINE(日DIF 日DEA,70,75,3,0),COLORFF8000;
日金叉:STICKLINE(日DIF 日DEA,70,75,3,0),COLORRED;
DRAWTEXT(ISLASTBAR,72,'__日MACD'),COLORYELLOW;
周DIF:= MACD.DIF#WEEK (12,26,9),NODRAW;
周DEA:= MACD.DEA#WEEK (12,26,9),NODRAW;
周死叉:STICKLINE(周DIF 周DEA,60,65,3,0),COLORFF8064;
周金叉:STICKLINE(周DIF 周DEA,60,65,3,0),COLOR3232FF;
DRAWTEXT(ISLASTBAR,62,'__周MACD'),COLORYELLOW;
月DIF:= MACD.DIF#MONTH (12,26,9),NODRAW;
月DEA:= MACD.DEA#MONTH (12,26,9),NODRAW;
月死叉:STICKLINE(月DIF 月DEA,50,55,3,0),COLORFF808C;
月金叉:STICKLINE(月DIF 月DEA,50,55,3,0),COLOR5032FF;
DRAWTEXT(ISLASTBAR,52,'__月MACD'),COLORYELLOW;
{}
DIF日:= MACD.DIF ,NODRAW;
DEA日:= MACD.DEA ,NODRAW;
MACD日金叉:=IF(CROSS(DIF日,DEA日),20,0),NODRAW;
DIF周:= MACD.DIF#WEEK ,NODRAW;
DEA周:= MACD.DEA#WEEK ,NODRAW;
MACD周金叉:=IF(CROSS(DIF周,DEA周),40,0),NODRAW;
STICKLINE((MACD周金叉 AND MACD日金叉),75,85,3,0)COLORYELLOW;
DRAWTEXT((MACD周金叉 AND MACD日金叉),80,' ★MACD日周共振'),COLORYELLOW;
DRAWICON(MACD周金叉 AND MACD日金叉,80,25);
{}
N:=1;
日K:=KDJ.K,NODRAW;
日D:=KDJ.D,NODRAW;
日J:=KDJ.J,NODRAW;
周K:=KDJ.K#WEEK,NODRAW;
周D:=KDJ.D#WEEK,NODRAW;
周J:=KDJ.J#WEEK,NODRAW;
月K:=KDJ.K#MONTH,NODRAW;
月D:=KDJ.D#MONTH,NODRAW;
月J:=KDJ.J#MONTH,NODRAW;
K日金叉:=CROSS(日K,日D) AND (日D 40 OR 日D
K周金叉:=CROSS(周K,周D) AND (周D 40 OR 周D
K月金叉:=CROSS(月K,月D) AND (月D 40 OR 月D
共振KDJ:=(K周金叉 AND K日金叉) OR (K周金叉 AND K月金叉) OR (K日金叉 AND K月金叉)OR (K日金叉 AND K周金叉 AND K月金叉);
STICKLINE(共振KDJ,0,40,3,0),COLORMAGENTA;{柱}
DRAWICON(共振KDJ,35,24);{图标}
DRAWTEXT((K周金叉 AND K日金叉) OR (K周金叉 AND K月金叉) OR (K日金叉 AND K月金叉)OR (K日金叉 AND K周金叉 AND K月金叉),
35,' ★KDJ(日/周/月)共振'),COLORMAGENTA;{字}
NOTEXT月K:=IF(N=3,月K,DRAWNULL),COLORWHITE,NODRAW;
NOTEXT月D:=IF(N=3,月D,DRAWNULL),COLORYELLOW,NODRAW;
NOTEXT月J:=IF(N=3,月J,DRAWNULL),COLORMAGENTA,NODRAW;
NOTEXT周K:=IF(N=2,周K,DRAWNULL),COLORWHITE,NODRAW;
NOTEXT周D:=IF(N=2,周D,DRAWNULL),COLORYELLOW,NODRAW;
NOTEXT周J:=IF(N=2,周J,DRAWNULL),COLORMAGENTA,NODRAW;
NOTEXT日K:=IF(N=1,日K,DRAWNULL),COLORWHITE,NODRAW;
NOTEXT日D:=IF(N=1,日D,DRAWNULL),COLORYELLOW,NODRAW;
NOTEXT日J:=IF(N=1,日J,DRAWNULL),COLORMAGENTA,NODRAW;
STICKLINE(日K =日D,30,25,3,0),COLOR8000FF;
STICKLINE(日K 日D,30,25,3,0),COLOR009600;
DRAWTEXT(ISLASTBAR,27,'__日KDJ'),COLORWHITE;
STICKLINE(周K =周D,20,15,3,0),COLOR803CFF;
STICKLINE(周K 周D,20,15,3,0),COLOR3C9600;
DRAWTEXT(ISLASTBAR,17,'__周KDJ'),COLORWHITE;
STICKLINE(月K =月D,10,5,3,0),COLOR8050FF;
STICKLINE(月K 月D,10,5,3,0),COLOR649600;
DRAWTEXT(ISLASTBAR,7,'__月KDJ'),COLORWHITE;
{}
40,LINETHICK1,COLORWHITE;
{}
DRAWRECTREL(0,0,180,990,RGB(250,0,250));
{日K:= KD.K (9,3,3);
日D:= KD.D (9,3,3);
日J:= KD.J (9,3,3);
周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); }
DRAWTEXT_FIX(ISLASTBAR,0.111,0.03,0,'KDJ (日/周/月)'),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.13,0,'日K ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.13,0,日K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.23,0,'日D ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.23,0,日D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.33,0,'日J ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.33,0,日J),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.43,0,'周K ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.43,0,周K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.53,0,'周D ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.53,0,周D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.63,0,'周J ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.63,0,周J),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.73,0,'月K = '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.73,0, 月K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.83,0,'月D ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.83,0,月D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.93,0,'月J ='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.93,0,月J),COLORFFFFFF;
{}
DRAWRECTREL(0,0,90,990,RGB(220,0,0));
{月DIF:= MACD.DIF#MONTH (12,26,9);
月DEA:= MACD.DEA#MONTH (12,26,9);
周DIF:= MACD.DIF#WEEK (12,26,9);
周DEA:= MACD.DEA#WEEK (12,26,9);
日DIF:= MACD.DIF (12,26,9);
日DEA:= MACD.DEA (12,26,9);}
DRAWTEXT_FIX(ISLASTBAR,0.018,0.03,0,'MACD(日/周/月)'),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.18,0,'日DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.18,0,日DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.31,0,'日DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.31,0,日DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.44,0,'周DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.44,0,周DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.57,0,'周DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.57,0,周DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.70,0,'月DIF= '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.70,0, 月DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.83,0,'月DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.83,0,月DEA),COLORFFFFFF;