四彩K线KDJ主图+三底背离主图
A:=MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1));
B:=MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
分水岭:=IF(MA(CLOSE,17)<B,B,MA(CLOSE,17)),COLORFF00FF,LINETHICK1;
PMA:=分水岭;
DD1:=分水岭<REF(分水岭,1);
{IF(DD1,分水岭,DRAWNULL),COLOR00FF00,LINETHICK1; }
操作线:=分水岭-(EMA(C,3)-分水岭),COLOR00FFFF,LINETHICK1;
S:=(PMA>操作线);
{IF(S,分水岭,DRAWNULL),COLOR00FF00,POINTDOT,LINETHICK1; }
PM:=MA(C,5),COLORFFFFCC,LINETHICK1;
{IF(PM>REF(PM,1),PM,DRAWNULL),COLORRED,LINETHICK1;
IF(PM=REF(PM,1),PM,DRAWNULL),COLORRED;
IF(PM<REF(PM,1),PM,DRAWNULL),COLORFF9900,LINETHICK1;}
DRAWTEXT(CROSS(分水岭,操作线),分水岭-0.1,'三底背离');
A1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));
B1:=REF(C,A1+1)>C AND REF("MACD.DIF",A1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA");
DRAWTEXT(B1>0,L-0.02,'M底背离'),COLOR00FFFF;
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,L-0.10,'K底背离'),COLORFF00FF;
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,L-0.18,'R底背离'),COLOR0000FF;
C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF",C1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF");
DRAWTEXT(D1>0,H+0.16,'M顶背离'),COLOR00FF00;
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,H+0.08,'K顶背离'),COLORFFFFCC;
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,H+0.04,'R顶背离'),COLORFF9900;
零轴:=DYNAINFO(3)*1,COLOR0000FF;
STICKLINE(1,90/100+零轴,90/100+零轴,2,0),COLOR00BBBB;
STICKLINE(1,10/100+零轴,10/100+零轴,2,0),COLOR0000BB;
STICKLINE(1,100/100+零轴,100/100+零轴,2,0),COLORBBBBBB;
STICKLINE(1,50/100+零轴,50/100+零轴,2,0),COLORFF0000;
STICKLINE(1,0/100+零轴,0/100+零轴,2,0),COLORBBBB00;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100+50/100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
KK:=零轴+K/100;
DD:=零轴+D/100;
JJ:=零轴+J/100;
EE:=50/100+零轴;
DRAWBAND(KK,RGB(200,0,150),EE,RGB(0,170,120));
DRAWBAND(JJ,RGB(220,0,0),KK,RGB(120,120,170));
DRAWKLINE(H,O,L,C);
AAA:=JJ>=KK AND KK>=EE;
BBB:=JJ>=KK AND KK<EE;
DDD:=JJ<KK AND KK>=EE;
EEE:=JJ<KK AND KK<EE;
STICKLINE(AAA,H,L,0,0),COLOR0000FF;
STICKLINE(BBB,H,L,0,0),COLORFF00FF;
STICKLINE(DDD,H,L,0,0),COLOR00FFFF;
STICKLINE(EEE,H,L,0,0),COLORFFFF00;
STICKLINE(AAA,CLOSE,OPEN,3.2,0),COLOR000099;
STICKLINE(AAA,CLOSE,OPEN,1.8,0),COLOR0000BB;
STICKLINE(AAA,CLOSE,OPEN,1.3,0),COLOR0000DD;
STICKLINE(AAA,CLOSE,OPEN,0.5,0),COLOR0000FF;
STICKLINE(BBB,CLOSE,OPEN,3.2,0),COLOR990099;
STICKLINE(BBB,CLOSE,OPEN,1.8,0),COLORAA00AA;
STICKLINE(BBB,CLOSE,OPEN,1.3,0),COLORDD00DD;
STICKLINE(BBB,CLOSE,OPEN,0.5,0),COLORFF00FF;
STICKLINE(DDD,C,O,3.2,0),COLOR009999;
STICKLINE(DDD,C,O,2.4,0),COLOR00BBBB;
STICKLINE(DDD,C,O,1.0,0),COLOR00DDDD;
STICKLINE(DDD,C,O,0.6,0),COLOR00FFFF;
STICKLINE(EEE,C,O,3.2,0),COLOR999900;
STICKLINE(EEE,C,O,1.6,0),COLORBBBB00;
STICKLINE(EEE,C,O,1.0,0),COLORDDDD00;
STICKLINE(EEE,C,O,0.5,0),COLORFFFF00;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),3,1)/SMA(ABS(CLOSE-LC),3,1)*100;
SELL2:=(CROSS(88,RSI1));
DRAWTEXT(SELL2,HIGH*1.02,'←卖'),COLOR00FF00;
VB1:=C-REF(C,1);
VB2:=100*EMA(EMA(VB1,6),6)/EMA(EMA(ABS(VB1),6),6);
VB3:=IF(LLV(VB2,2)=LLV(VB2,7) AND COUNT(VB2<0,2) AND CROSS(VB2,MA(VB2,2)),1,0);
VB4:=FILTER(VB3=1,5);
DRAWTEXT(VB4,LOW*0.98,'←买'),COLOR00FFFF;
DRAWTEXT_FIX(1,0,0,0,HYBLOCK);
威廉波段:=100-(HHV(HIGH,34)-CLOSE)/(HHV(HIGH,34)-LLV(LOW,34))*100;
威廉风险:=IF(威廉波段>95,(100/100+零轴)-(100/100+零轴)*0.009,100/100+零轴),COLOR00FFFF,LINETHICK0;
DRAWBAND(100/100+零轴,RGB(220,220,0),威廉风险,RGB(0,0,0));
WLDB:=IF(威廉波段<5,(0/100+零轴)+(0/100+零轴)*0.009,0/100+零轴),COLORFFFF00,LINETHICK1;
DRAWBAND(WLDB,RGB(0,220,220),0/100+零轴,RGB(0,0,0));
DRAWTEXT_FIX(1,0.05,0.0,0,'【彩色K线标识】★★红色柱---J大于K并在中轴上★★黄色柱--J小于K并在中轴上★★ '),COLORFFFFFF;
DRAWTEXT_FIX(1,0.05,0.035,0,'【彩色K线标识】★★粉色柱---J大于K并在中轴下★★青色柱--J小于K并在中轴下★★ '),COLOR00FFFF;
DRAWTEXT_FIX(1,0.05,0.07,0,'【彩色三角型标识】★★青色三角形---威廉底部★★黄色三角形--威廉顶部★★ '),COLORFFFF00;
ZGB:VOL*100/HSCOL.HSCOL,NODRAW;
DRAWTEXT(ZGB-REF(ZGB,1)>50,H,'解禁日')COLORGREEN;
MA30生命线:MA(C,30)LINETHICK1,COLORWHITE;
MA60牛熊线:MA(C,60)LINETHICK1,COLORRED;
黄金线:(EMA(C,18)),POINTDOT,LINETHICK5,COLORYELLOW;
MA43神奇线:MA(C,43)POINTDOT,LINETHICK5,COLORGREEN;
_10日涨跌%: (C-REF(CLOSE,10))/REF(CLOSE,10)*100,COLORGREEN,NODRAW;
涨家数:INDEXADV,COLOR0080FF,NODRAW;
跌家数:INDEXDEC,COLORGREEN,NODRAW;
涨停:C+0.05>=(ROUND(REF(C,1)*(100+10*(2-NAMELIKE('ST'))/2))/100),COLOR0080FF,NODRAW;
跌停:C-0.05<=(ROUND(REF(C,1)*(100-10*(2-NAMELIKE('ST'))/2))/100),COLORGREEN,NODRAW;
Z1:=STRCAT(HYBLOCK,' ');
Z2:=STRCAT(Z1,FGBLOCK);
Z3:=STRCAT(Z2,DYBLOCK);
Z4:=STRCAT(Z3,' ');
DRAWTEXT_FIX(ISLASTBAR,0.00,0.99,0,STRCAT(Z4,GNBLOCK)),COLORYELLOW;
TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,240,1)))));
MTIME:=MOD(FROMOPEN,TOTAL);
CTIME:=IF(MTIME<0.5,TOTAL,MTIME);
VV:=IF(CURRBARSCOUNT=1,VOL*TOTAL/CTIME,V);
N9:=120;
A100:=CONST(HHV(H,N9)-LLV(L,N9))/CONST(HHV(VV,N9));
B100:=CONST(LLV(L,N9))-CONST(HHV(VV,N9))*A100/8;
天数:=10;
STICKLINE(CURRBARSCOUNT=1 && (SETCODE=0 || SETCODE=1),B100+VV*A100/8,B100,-1,-1),COLOR00C0C0;
STICKLINE(C>=O AND CURRBARSCOUNT<=天数,B100+VV*A100/8,B100,3,1),COLOR3232FF;
STICKLINE(C<O AND CURRBARSCOUNT<=天数,B100+VV*A100/8,B100,3,0),COLORFFFF54;
{分析家公式网 WWW.88GS.COM}
DRAWRECTREL(0,580,100,960,RGB(150,0,0));
DRAWRECTREL(100,580,200,960,RGB(0,150,150));
DRAWRECTREL(200,725,300,960,RGB(150,0,150));
日K:="KD.K"(9,3,3);
日D:="KD.D"(9,3,3);
月K:="KDJ.K#MONTH"(9,3,3);
月D:="KDJ.D#MONTH"(9,3,3);
周K:="KDJ.K#WEEK"(9,3,3);
周D:="KDJ.D#WEEK"(9,3,3);
DRAWTEXT_FIX(ISLASTBAR,0.04,0.60,0,'KDJ '),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.65,0,'日K='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.65,0,日K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.7,0,'日D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.7,0,日D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.75,0,'周K='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.75,0,周K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.8,0,'周D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.8,0,周D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.85,0,'月K= '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.85,0, 月K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.9,0,'月D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.9,0,月D),COLORFFFFFF;
日DIF:="MACD.DIF"(12,26,9);
日DEA:="MACD.DEA"(12,26,9);
周DIF:="MACD.DIF#WEEK"(12,26,9);
周DEA:="MACD.DEA#WEEK"(12,26,9);
月DIF:="MACD.DIF#MONTH"(12,26,9);
月DEA:="MACD.DEA#MONTH"(12,26,9);
DRAWTEXT_FIX(ISLASTBAR,0.13,0.60,0,'MACD '),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.65,0,'日DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.65,0,日DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.7,0,'日DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.7,0,日DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.75,0,'周DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.75,0,周DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.8,0,'周DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.8,0,周DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.85,0,'月DIF= '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.85,0, 月DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.11,0.9,0,'月DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.155,0.9,0,月DEA),COLORFFFFFF;
TYP:=(HIGH+LOW+CLOSE)/3;
日CCI:=(TYP-MA(TYP,84))/(0.015*AVEDEV(TYP,84));
周CCI:=(TYP-MA(TYP,21))/(0.015*AVEDEV(TYP,21));
月CCI:=(TYP-MA(TYP,9))/(0.015*AVEDEV(TYP,9));
DRAWTEXT_FIX(ISLASTBAR,0.235,0.75,0,'CCI'),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.206,0.80,0,'日CCI='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.250,0.80,0,日CCI),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.206,0.85,0,'周CCI='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.250,0.85,0,周CCI),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.206,0.90,0,'月CCI='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.250,0.90,0,月CCI),COLORFFFFFF;
{数字显示涨跌停K线天数}
A1000:=REF(C,1);
涨停A:=IF((C-A1000)*100/A1000>=(10-0.01*100/A1000),1,0);
跌停A:=IF((A1000-C)*100/A1000>=(10-0.01*100/A1000),1,0);
涨停次数:=COUNT(涨停A,BARSSINCE(涨停A)+1);
跌停次数:=COUNT(跌停A,BARSSINCE(跌停A)+1);
DRAWNUMBER(涨停A,HIGH*1.04,涨停次数),COLORYELLOW;
DRAWNUMBER(跌停A,HIGH*1.04,跌停次数),COLORCYAN;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.62,0.95,0,涨停次数),COLORYELLOW;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.72,0.95,0,跌停次数),COLORCYAN;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.55,0.95,0,'上市以来共涨停:'),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.65,0.95,0,'上市以来共跌停:'),COLORCYAN;
涨停K线:=IF((C-A1000)*100/A1000>=(10-0.01*100/A1000),1,0);
跌停K线:=IF((A1000-C)*100/A1000>=(10-0.01*100/A1000),1,0);