{================背景 ================};
DRAWGBK(ISLASTBAR, RGB(60,60,60),RGB(0,0,0),0,'0',0);
字:=STRCAT(STRCAT(STRCAT(' : ',STKNAME),' 代码: '),CODE);
DRAWTEXT_FIX(ISLASTBAR,0.6,0,0,字),COLORYELLOW;
{红}STICKLINE(C>O,C,O,3,0),COLORRED ;STICKLINE(C>O,H,L,0,0),COLORRED;
{绿}STICKLINE(C<O,C,O,3,0),COLORCYAN;STICKLINE(C<O,H,L,0,0),COLORCYAN;
黑马:INDEXADV,COLORMAGENTA ,NODRAW;
优化:INDEXADV,COLORYELLOW,NODRAW;
我主沉浮:INDEXADV,COLORMAGENTA ,NODRAW;
M:=8;
CC:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);
BB:=ABS((CLOSE+2*HIGH+LOW)/4-MA(CLOSE,17))/MA(CLOSE,17);
DD:=DMA(CLOSE,CC);
EE:=DMA(CLOSE,BB);
低吸:=REF((1-3/100)*EE,2);
强弱分界线:EMA(低吸,7),LINETHICK1,COLORGREEN ;
DRAWTEXT(ISLASTBAR,强弱分界线,'【牛熊分界线】'),COLORCYAN ;
启动上攻关注:0,COLOR00FFFF,NODRAW;
红K强势持股:0,COLORRED,NODRAW;
紫K反弹不贪:0,COLORFF0FFF,NODRAW;
蓝K卖出观望:0,COLORFF6C00,NODRAW;
分界线变红转强:强弱分界线,COLORRED,NODRAW;
高抛线:(1+M/100)*DD, ;
高抛线不过减仓:高抛线,COLORYELLOW ,LINETHICK1;
DRAWTEXT(ISLASTBAR, 高抛线不过减仓,'←强势上涨线'),COLORYELLOW;
短支撑:EMA((LLV((C+L)/2,6)+LLV((C+L)/2,5)
+LLV((C+L)/2,4)+LLV((C+L)/2,3)+LLV((C+L)/2,2)+2*(C+L+H)/3)/7,4),COLORGREEN ;
IF(强弱分界线>REF(强弱分界线,1)*0.999 ,强弱分界线,DRAWNULL),COLORCYAN ,LINETHICK3;
IF(强弱分界线<REF(强弱分界线,1)*0.999 ,强弱分界线,DRAWNULL),COLORFF6C00,LINETHICK3;
波段趋势:=EMA(短支撑,4);
IF(短支撑>=REF(短支撑,2)*0.998 AND C>短支撑,短支撑,DRAWNULL),COLORRED ,LINETHICK1;
DRAWTEXT(ISLASTBAR, 短支撑,' ←中线操作'),COLORRED;
涨幅:=(C-REF(C,1))/REF(C,1)*100;
走平支撑线:=LLV((HIGH+2*LOW+OPEN+CLOSE)/5*2.03-H,30)*1.006,COLORABFF40,LINETHICK2;
穿两线:=((CROSS(C,短支撑) AND CROSS(C,波段趋势)) OR (L<短支撑 AND C>波段趋势 AND 短支撑<波段趋势 ))
{ AND 短支撑>REF(短支撑,1)} AND C>REF(C,1)*1.02 AND (C-O>H-C) AND V>REF(V,1) AND (C>强弱分界线 OR C<强弱分界线 AND C>REF(C,1)*1.07);
DRAWTEXT(穿两线,L*0.985,'上攻'),COLORRED;
STICKLINE(穿两线,H,C,0.1,1),COLORYELLOW,LINETHICK2;
STICKLINE(穿两线,O,C,4.2,1),COLORYELLOW,LINETHICK2;
STICKLINE(穿两线,O,L,0.1,1),COLORYELLOW,LINETHICK2;
探底回升:=((CROSS(C,短支撑) AND CROSS(C,强弱分界线)) OR (CROSS(C,短支撑) AND 短支撑<强弱分界线*1.07))
AND C>强弱分界线 AND 强弱分界线>REF(强弱分界线,1)*0.999 AND 强弱分界线<REF(强弱分界线,3)*0.9 AND C>REF(C,1)*1.02;
回档:=L<短支撑 AND L<强弱分界线 AND C>强弱分界线 AND 强弱分界线>REF(强弱分界线,1) AND C>REF(C,1)*1.02;
{上升中继条件}
EMA3:=EMA(C,3);
EMA13:=EMA(C,13);
上升中继:=BARSLAST(REF(CROSS(EMA13,EMA3),1)) AND CROSS(EMA3,EMA13) AND C>强弱分界线 AND 强弱分界线>REF(强弱分界线,1)*0.99 AND REF(涨幅,1)<4 AND (C-O>H-C);
DRAWTEXT(上升中继,L*0.98,'启动'),COLOR00FFFF;
双穿:=CROSS(C,强弱分界线) AND CROSS(C,短支撑) AND 强弱分界线>=REF(强弱分界线,1)*0.999 AND 短支撑>强弱分界线;
DRAWTEXT(双穿,L*0.98,'双穿'),COLORRED;
{STICKLINE(探底回升 OR 回档 ,H,L,0,1),COLOR00FF00;
STICKLINE(探底回升 OR 回档,O,C,3,1),COLOR00FF00;}
STICKLINE( C>短支撑 AND C>走平支撑线 AND 短支撑>REF(短支撑,2)*0.995 AND 波段趋势>REF(波段趋势,1) ,HIGH,LOW,0,1 ),COLORRED;
STICKLINE( C>短支撑 AND C>走平支撑线 AND 短支撑>REF(短支撑,2)*0.995 AND 波段趋势>REF(波段趋势,1),OPEN,CLOSE,3,1 ),COLOR0000AA ;
STICKLINE(C<O AND C>短支撑 AND {短支撑>REF(短支撑,1)}C>波段趋势 AND 波段趋势>REF(波段趋势,1),HIGH,LOW,0,0 ),COLORRED;
STICKLINE(C<O AND C>短支撑 AND C>波段趋势{短支撑>REF(短支撑,1)} AND 波段趋势>REF(波段趋势,1) ,OPEN,CLOSE,3,0 ),COLOR0000AA;
LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
{顶背离:=CROSS(88,RSI) AND V>MA(V,33);
DRAWTEXT(顶背离,H*1.02,'顶背离'),COLOR00FF00;}
DRAWTEXT(IF(CROSS(69,SMA(MAX(CLOSE-REF(CLOSE,1),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),13,1)*100),1,0) AND C<REF(C,1)*0.965,HIGH*1.025,'预警'),COLORCYAN;
{反弹K线的定义}
STICKLINE(L<强弱分界线 AND C>短支撑 AND C>走平支撑线 AND 短支撑>REF(短支撑,2)*0.995 AND 波段趋势>REF(波段趋势,1) AND C<REF(C,1)*1.06,HIGH,LOW,0,1 ),COLORFF00FF;
STICKLINE(L<强弱分界线 AND C>短支撑 AND C>走平支撑线 AND 短支撑>REF(短支撑,2)*0.995 AND 波段趋势>REF(波段趋势,1) AND C<REF(C,1)*1.06,OPEN,CLOSE,3,1 ),COLORFF00FF;
STICKLINE(L<强弱分界线 AND C<O AND C>短支撑 AND {短支撑>REF(短支撑,1)}C>波段趋势 AND 波段趋势>REF(波段趋势,1) AND C<REF(C,1)*1.06,HIGH,LOW,0,0 ),COLORFF00FF;
STICKLINE(L<强弱分界线 AND C<O AND C>短支撑 AND C>波段趋势{短支撑>REF(短支撑,1)} AND 波段趋势>REF(波段趋势,1) AND C<REF(C,1)*1.06 ,OPEN,CLOSE,3,0 ),COLORFF00FF;
波段:=EMA(((SLOPE(C,22)*20)+C),55),COLORFF00FF,LINETHICK2;
买进价:=((C-REF(MA(C,6),1))/6+MA(C,6))*1.004;
买进条件:=CROSS(C,买进价) AND 买进价>REF(买进价,1) AND C>波段;
{黄托底条件}
加码价:=((C-REF(MA(C,17),1))/18+MA(C,17))*1.004;
加码条件:=CROSS(C,加码价) AND 加码价>REF(加码价,1);
TTR:=EMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),4);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EMA(IF(HD>0 AND HD>LD,HD,0),4);
DMM:=EMA(IF(LD>0 AND LD>HD,LD,0),4);
PDI:=DMP*100/TTR;
MDI:=DMM*100/TTR;
ADX:=EMA(ABS(MDI-PDI)/(MDI+PDI)*100,1);
ADXR:=EMA(ADX,1);
DMI选股:=CROSS(PDI,MDI) AND ADX<REF(ADX,1) AND C>REF(C,1)*1.05;
MID:=MA(CLOSE,17);
短线BBI:=MID + 1*STD(CLOSE,17);
短BBI追:=CROSS(C,短线BBI) AND C>REF(C,1)*1.04;
短线操盘:=REF(LLV(H*0.98,3),1);
波段操盘:=EMA(短线操盘,2);
短线支撑:=EMA(EMA((2*L+C)/3,5),10);
强弱分水岭:=MA(短线支撑,20);
双穿买点:=CROSS(C,波段操盘) AND CROSS(C,强弱分水岭) AND C>强弱分界线*1.015 AND 短支撑>REF(短支撑,1) AND C>强弱分界线;
白绿选股:=(((买进条件 AND 加码条件 AND C>REF(C,1)*1.025 ) OR (买进条件 AND C>REF(C,1)*1.047 AND C<波段*1.08)
OR (加码条件 AND C>REF(C,1)*1.07 ) ) OR DMI选股 OR 短BBI追) AND REF(HHV(H,20),10)<强弱分水岭*1.20 AND C<强弱分水岭*1.13 AND C>强弱分界线;
STICKLINE(白绿选股 OR 双穿买点,L*0.996,L*0.98,3,0),COLORYELLOW;
STICKLINE( 短支撑<波段趋势 AND 波段趋势<REF(波段趋势,1)*0.999 AND NOT(穿两线) AND NOT(探底回升) AND NOT(回档) AND NOT(上升中继) AND NOT(白绿选股 OR 双穿买点)AND 涨幅<7,HIGH,LOW,0,0 ),COLORCYAN ;
STICKLINE( 短支撑<波段趋势 AND 波段趋势<REF(波段趋势,1)*0.999 AND NOT(穿两线) AND NOT(探底回升) AND NOT(回档) AND NOT(上升中继) AND NOT(白绿选股 OR 双穿买点)AND 涨幅<7,OPEN,CLOSE,2.8,1 ),COLORCYAN ;
ZT:=C/REF(C,1)>1.097;
ZTBPJ:=REF(C,BARSLAST(ZT)+1)*0.98;{涨停不破价}
ZTBP:=BARSLAST(ZT)<30 AND (LLV(C,BARSLAST(ZT))>=ZTBPJ OR
LLV(C,BARSLAST(ZT))=ZTBPJ);{涨停不破价}
STICKLINE(ZTBP,REF(C,BARSLAST(ZT)+1)-REF(C,BARSLAST(ZT)+1)*0.001,REF(C,BARSLAST(ZT)+1),1,0),COLORYELLOW;
DRAWTEXT(ZT,L*0.98,'.'),COLORLIMAGENTA;
不破价:=REF(L,BARSLAST(ZT));
LS0:=BARSLAST(ZT);LS11:=IF(2,LS0=2,ZT);
LS21:=IF(2,LLV(L,2)>REF(L,2),1);
ZT不破2:=LS11 AND LS21;
DRAWTEXT(ZT不破2,不破价-不破价*0.02,'3'),COLORGREEN;
LS14:=IF(4,LS0=4,ZT);
LS24:=IF(4,LLV(L,4)>REF(L,4),1);
ZT不破4:=LS14 AND LS24;
DRAWTEXT(ZT不破4,不破价-不破价*0.02,'5'),COLORGREEN;
LS17:=IF(7,LS0=7,ZT);
LS27:=IF(7,LLV(L,7)>REF(L,7),1);
ZT不破7:=LS17 AND LS27;
DRAWTEXT(ZT不破7,不破价-不破价*0.02,'8'),COLORGREEN;
LS22:=IF(12,LS0=12,ZT);
LS32:=IF(12,LLV(L,12)>REF(L,12),1);
ZT不破12:=LS22 AND LS32;
DRAWTEXT(ZT不破12,不破价-不破价*0.02,'13'),COLORGREEN;
XH:=FILTER(ZT,13);
BH:=BARSLAST(ZT);
CZ:=REF(H,BH)-REF(L,BH);
迫线:=C>O AND V>REF(V,1) AND L>REF(C,1) AND REF(ZT,1);
小阳:=C>O AND V>REF(V,1) AND REF(ZT,1);
起爆:=REF(HHV(V,8),1)/V>=1.97 AND REF(HHV(小阳,8),1) AND C>O;
STICKLINE(ZT,REF(O,BH),REF(C,BH),0,1),COLORYELLOW;
STICKLINE(迫线,O,C,2,0),COLORMAGENTA;
DRAWTEXT(起爆,L*0.92,'.'),COLORRED;
Q:=MA(C,2);
OK:=CROSS(Q,REF(Q,1)) AND REF(HHV(ZT,8),1);
DRAWTEXT(OK,L,'低买'),COLORFF99FF;
{==============短线必赚主升线============}
短线5日:EMA(C,5),COLORWHITE ,LINETHICK1;
DRAWTEXT(ISLASTBAR,短线5日,' ←超短线'),COLORWHITE;
升:IF(短线5日>REF(短线5日,1),短线5日,DRAWNULL),COLORMAGENTA ,LINETHICK2;
A0:=(L+H+C*2)/4;
A1:EMA(A0,5)COLORWHITE ,LINETHICK1;
A2:=EMA(A0,10)COLORLIBLUE,LINETHICK1;
A1X:=(A1-REF(A1,1))/REF(A1,1)*100,NODRAW;
A2X:=(A2-REF(A2,1))/REF(A2,1)*100,NODRAW;
买入持股:IF(A1X>=0,A1,DRAWNULL)COLORYELLOW ,LINETHICK2;
卖出空仓:IF(A1X<0 AND A2X<0,A1,DRAWNULL)COLORGREEN,LINETHICK1;
{===========加仓、买入=============};
AA05:MA(C,5),COLORWHITE ,NODRAW;
五日乖离率:=(C-AA05)/AA05*100;
AA30:MA(C,30)COLORBLUE,NODRAW;
三拾日乖离率:=(C-AA30)/AA30*100,LINETHICK0;
MR:=COUNT(CROSS(五日乖离率,0),3)>=1 AND 三拾日乖离率>REF(三拾日乖离率,1) AND AA05>REF(AA05,1) AND (C/REF(C,1)-1)*100>5 AND REF(C,1)<AA30;
买入:=FILTER(MR,10);
BB05:=ATAN((AA05/REF(AA05,1)-1)*100)*180/3.1416;
速度5:=SMA(EMA((AA05-REF(AA05,1))/REF(AA05,1),3)*100,3,1);
加速度5:=EMA((速度5-REF(速度5,1)),3),LINETHICK0;
AA10:MA(C,10)COLORMAGENTA ,LINETHICK2,NODRAW;
加仓:=FILTER(COUNT(CROSS(BB05,30),5)>=1 AND AA05>REF(AA05,1) AND 三拾日乖离率>REF(三拾日乖离率,1) AND AA10>REF(AA10,1)AND 加速度5>REF(加速度5,1) AND 速度5>REF(速度5,1) ,10);
DRAWTEXT(买入,LOW*0.95,'买入'),COLORYELLOW;
DRAWTEXT(加仓,LOW*0.98,'↖加仓'),COLORYELLOW;
{================超牛=================}
转强:=100*(C-REF(C,12))/REF(C,12);
超强:=((H+L+C)/3-MA((H+L+C)/3,88))/(0.015*AVEDEV((H+L+C)/3,88));
通道:=1.07*DMA(C,ABS((2*C+H+L)/4-MA(C,26))/MA(C,26));
趋势:=MA(ATAN(通道-REF(通道,1)),3);
QS1:=IF((C>O OR C<O) AND H>=REF(C,1),ATAN(MA(H,5)*1.02-REF(MA(C,5)*1.02,1)),0);
QS2:=IF((C>O OR C<O) AND H<REF(C,1),-ATAN(REF(MA(C,5)*1.02,1)-MA(H,5)*1.02),0);
分界:=MA(REF((QS1+QS2),1),26);
强势:=趋势>分界 AND 趋势>REF(趋势,1);
超级牛股:=强势 AND 超强>200 AND 转强>20 AND C>REF(C,1);
DRAWTEXT(超级牛股,L*0.95,'↖牛'),COLORYELLOW ,LINETHICK2;