DRAWGBKlast(c>0,strip(RGB(0,0,60),RGB(0,0,0),0));
80,DOTLINE;20,DOTLINE;
J9:EMA("kdj.J"(9,3,3),5) ,COLOR0000FF,LINETHICK2;
J18:EMA("kdJ.J"(18,3,3),5) ,COLOR00FFFF,DOTLINE;
J27:EMA("KDJ.J"(27,3,3),5) ,COLOR00FF00,DOTLINE;
J36:EMA("KDJ.J"(36,3,3),5) ,COLOR0077FF,DOTLINE;
J45:EMA("KDJ.J"(45,3,3),5) ,COLOR00FFCC,LINETHICK2;
A级顶:=J9>80 AND J18>80 AND J27>80 AND J36>80 AND J45>80;
B级顶:=(J9>80 OR J18>80) AND (J27>80 OR J36>80 OR J45>80);
A级低:=J9<5 AND J18<5 AND J27<5 AND J36<5 AND J45<5;
B级低:=J9<10 AND J18<20 AND (J27<10 OR J36<10 OR J45<10);
IF(A级顶,90,100),COLOR0077FF,LINETHICK3,LAYER2;
IF(B级顶 ,80,100),COLOR00FF00,LINETHICK2,LAYER0;
IF(A级低,10,0),COLOR00FF00,LINETHICK2,LAYER0;
IF(B级低,20,0),COLORFF9900,LINETHICK2,LAYER2;
FILLRGN(IF(A级顶,90,100),90),ColorFF2200,LAYER5;;
FILLRGN(IF(B级顶,80,100),80),ColorFF9900,LAYER6;;
FILLRGN(100,80),Color000000,LAYER7;;
FILLRGN(10,20,10<20,RGB(0,40,60)),LAYER7;
FILLRGN(0,10,0<10,RGB(0,60,0)),LAYER7;
选股A:A级低,LINETHICK0;
{低部}
DIBU:= "KDJ.K"(9,3,3)<15 AND "KDJ.D"(9,3,3)<15 AND "KDJ.K"(18,3,3)<15 AND "KDJ.D"(18,3,3)<15
AND "KDJ.K"(27,3,3)<20 AND "KDJ.D"(27,3,3)<20 AND "KDJ.D"(36,3,3)<20 AND "KDJ.D"(54,3,3)<20;
STICKLINE(DIBU=1,30,20,1,0),COLORff00ff,LAYER5;
STICKLINE(DIBU=1,20,10,2,0),COLORYELLOW,LAYER5;
STICKLINE(DIBU=1,10,0,8,0),COLORff8000,LINETHICK2,LAYER5;
选股B:DIBU,LINETHICK0;
{大盘KDJ}
DRSV:=(INDEXC-LLV(INDEXL,27))/(HHV(INDEXH,27)-LLV(INDEXL,27))*100;
DK:=SMA(DRSV,3,1);
DD:=SMA(DK,3,1);
DJ:EMA((3*DK-2*DD),5),COLOR00FFFF;
PARTLINE(DJ,(DJ>REF(DJ,1))-1,rgb(0,255,0),1,rgb(255,0,0) ),POINTDOT,LINETHICK6,LAYER1;
{macd}
DIF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK0;
DEA:=EMA(DIF,9);
VAR1:=HHV(DEA,53);
VAR2:=LLV(DEA,55);
VAR3:=DEA-(DIF-DEA);
UP:=IF(DIF>VAR1 AND DEA=VAR1,MAX(LLV(VAR1,10),VAR3),VAR1);
DN:=IF(DIF<VAR2 AND DEA=VAR2,MIN(HHV(VAR2,10),VAR3),VAR2);
PARTLINE(105,DIF>UP,RGB(255,0,0)),LINETHICK5,LAYER4;
PARTLINE(104,DIF>UP,RGB(255,120,0)),LINETHICK5,LAYER5;
PARTLINE(103,DIF>UP,RGB(255,200,0)),LINETHICK5,LAYER6;
PARTLINE(-3,DIF<DN,RGB(0,130,100)),LINETHICK5,LAYER4;
PARTLINE(-4,DIF<DN,RGB(0,220,0)),LINETHICK6,LAYER5;
{KDJ周金叉死叉}
周K:"KDJ.K#WEEK"(9,2,5),COLOR0000FF,LINETHICK0,LAYER3;
周D:"KDJ.D#WEEK"(9,2,5),COLOR00FF00,LINETHICK0;
DRAWTEXT(crOSS(周K,周D),30,'J周金叉'),ALIGN1,color00FFFF,LINETHICK1;
DRAWTEXT(CROSS(周D,周K),70,'J周死叉'),ALIGN1,COLOR0077FF,LINETHICK1;
KDB:=BARSLAST(REF(CROSS(周K,周D),1));
KDDB:=REF(WMA(C,5),KDB+1)>WMA(C,5) AND REF(周K,KDB+1)<周K AND CROSS(周K,周D);
K底背:=IF(FILTER(KDDB>0,5),1,0);
DRAWTEXT(K底背=1,15,'J周底背'),COLOR00FFFF,LINETHICK1;
KDD:=BARSLAST(REF(CROSS(周D,周K),1));
K顶背:=REF(WMA(C,5),KDD+1)<WMA(C,5) AND REF(周K,KDD+1)>周K AND CROSS(周D,周K);
DRAWTEXT(FILTER(K顶背>0,5),80,'J周顶背'),COLOR0077FF,LINETHICK1;
{顶底背离}
{1.MACD}
A1:=BARSLAST(REF(CROSS("MACD.DIFF","MACD.DEA"),1));
B1:=REF(C,A1+1)>C AND REF("MACD.DIFF",A1+1)<"MACD.DIFF" AND CROSS("MACD.DIFF","MACD.DEA");
DRAWTEXT(B1>0,-2,'M底背'),COLOR00FFFF,LINETHICK1;{MACD底背离};
C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIFf"),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIFf",C1+1)>"MACD.DIFf" AND CROSS("MACD.DEA","MACD.DIFf");
DRAWTEXT(D1>0,105,'M顶背'),COLOR00FF00,LINETHICK1;{MACD顶背离};
{2.KDJ}
A2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K",A2+1)<"KDJ.K" AND CROSS("KDJ.K","KDJ.D");
DRAWTEXT(B2,5,'J9底背'),COLOR00FFFF,LINETHICK1;{KDJ底背离};
C2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K",C2+1)>"KDJ.K" AND CROSS("KDJ.D","KDJ.K");
DRAWTEXT(D2>0,80,'J9顶背'),COLOR0077FF,LINETHICK1;{KDJ顶背离};
{3.rsi}
A3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1",A3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2");
DRAWTEXT(B3>0,24,'R底背'),COLOR00FFFF,LINETHICK1;{RSI底背离}
C3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1",C3+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1");
DRAWTEXT(D3>0,95,'R顶背'),COLOR0077FF,LINETHICK1;{RSI顶背离};