养家系列组合工具,一键寻找市场妖股「第一讲 源码」
微头条有字数限制,没有办法发这么多的内容,所以放到文章编辑器里,欢迎大家使用,视频讲解为 【养家系列组合工具,一键寻找市场妖股】
XA_1:=MA(C,10);{10 日均线}
XA_2:=MA(C,54);{54 日均线}
XA_3:=(REF(CLOSE,3)-CLOSE)/REF(CLOSE,3)*100>5;{今日较前3日下跌大于5%}
XA_4:=FILTER(XA_3,10); {10 天内第一次满足较前3日下跌5%的条件,之后满足的不记录}
XA_5:=BARSLAST(XA_4); {XA_4条件成立到当前的周期数}
XA_6:=REF(HIGH,XA_5+2); {取XA_5成立之后+2天的最高价}
XA_7:=REF(HIGH,XA_5+1); {取XA_5成立之后+1天的最高价}
XA_8:=REF(HIGH,XA_5); {取XA_5成立之后那天的最高价}
XA_9:=MAX(XA_6,XA_7);
XA_10:=MAX(XA_9,XA_8); {9和10的意思在于取 6、7、8三个值中最大值}
XA_11:=(CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100>5; {相较于昨天收盘价大于5%}
XA_13:=(OPEN-XA_10)/XA_10*100<30; {(开盘价相较于6、7、8的值涨幅小于30%}
XA_14:=(CLOSE-LLV(LOW,XA_5))/LLV(LOW,XA_5)*100<50; {收盘价相较于XA_4之后的最低价涨幅小于50%}
XA_15:=(CLOSE-REF(OPEN,5))/REF(OPEN,5)*100<30; {收盘价相较于5天前的收盘价涨幅小于30%}
XA_16:=VOL/MA(VOL,5)<3.5; {成交量/5日均量线<3.5}
XA_17:=(CLOSE-REF(CLOSE,89))/REF(CLOSE,89)*100<80; {收盘价相较于前面89天的收盘价涨幅小于80%}
XA_18:=XA_11 AND XA_13 AND XA_14 AND XA_15 AND XA_16 AND XA_17; {11----18条件都满足 }
XA_19:=FILTER(XA_18,15);{15天内满足A_18的条件,且15天以后满足的不记录}
XA_20:=(CLOSE-XA_2)/XA_2<0.1; {收盘价在54日均线之上10%以内}
XA_21:=(CLOSE-XA_1)/XA_1<0.3; {收盘价在10日均线之上30%以内}
XA_22:=(XA_20=1 AND XA_21=1)*0.2; {20条件和21条件都满足取值0.2}
XA_23:=(XA_22=0 AND REF(XA_22,1)=0.2 AND REF(COUNT(XA_22=0.2,10)=10,1)=1)*(-0.1);{当前不满足22条件,昨天满足22条件,统计1日前10日中满足XA_22=0.2的天数*-0.1}
XA_24:=XA_23=(-0.1); {前10日中有满足20和21的条件}
XA_25:=XA_19 OR XA_24; {满足19条件或者24条件}
XA_26:=DMA(AMOUNT/VOL/100,VOL/CAPITAL);{以成交量(手)/当前流通股本(手)为权重成交额(元)/成交量(手)/100的动态移动平均}
XA_27:=DYNAINFO(7)/REF(CLOSE,1)>1.05 AND DYNAINFO(7)/OPEN>1.05;{现价相较于昨天收盘价涨幅大于5% 且 相较于开盘价涨幅大于5%}
XA_28:=VOL/REF(VOL,1)>1.2 AND COUNT(CLOSE>OPEN,1) OR (LOW>REF(HIGH,1) AND COUNT(OPEN>CLOSE,1) AND VOL/REF(VOL,1)>1.2);
{成交量大于昨日成交量20%且收阳或者最低价大于昨日最高价且收阴且成交量大于昨日成交量20%}
XA_29:=VOL/CAPITAL*100;{当前成交量占流通股本的比例*100}
XA_30:=VOL>=1.9*REF(VOL,1) AND XA_29>4;{成交量大于等于昨日成交量90%且当前成交量占流通股本的4%}
XA_31:=SUMBARS(XA_30,1);{XA_30累加至1的天数}
XA_32:=STICKLINE(XA_31,REF(CLOSE,XA_31-1),REF(CLOSE,XA_31-1),10,0);{当满足条件XA_31时,在XA_31-1日前的收盘价和XA_31-1日前的收盘价位置之间画柱状线}
XA_33:=STICKLINE(XA_31,REF(OPEN,XA_31-1),REF(OPEN,XA_31-1),10,0);{当满足条件XA_31时,在XA_31-1日前的开盘价和XA_31-1日前的开盘价位置之间画柱状线}
XA_34:=IF(NAMELIKE(7),0,1);{如果模糊匹配品种名称,返回0,否则返回1}
XA_35:=DYNAINFO(8)>0;{总量大于0}
XA_36:=IF(NAMELIKE(8),0,1);{如果模糊匹配品种名称,返回0,否则返回1}
XA_37:=XA_34 AND XA_35 AND XA_36;{同时满足35/36/37的条件}
XA_38:=(CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100;{收盘价处于最近27天K线的位置}
XA_39:=SMA(XA_38,9,1);{XA_38的9日[1日权重]移动平均}
XA_40:=SMA(XA_39,9,1);{XA_39的9日[1日权重]移动平均}
XA_41:=CROSS(XA_39,XA_40);{39上穿40}
XA_42:=(CLOSE-MA(CLOSE,5))/MA(CLOSE,5)*100;{收盘价距离5日均线的比例*100}
XA_43:=COUNT(XA_41,21)>=2;{21日内满足XA__41条件两次或两次以上}
XA_44:=XA_39<20;{XA_39<20}
XA_45:=MA(CLOSE,10)>REF(MA(CLOSE,10),1);{10日均线值大于昨天的10日均线值(10日均线上扬)}
XA_46:=COUNT(XA_42<(-8),20)>=1 AND XA_42<=0 AND COUNT(XA_42<=0,4)>=2;{统计20日中满足XA_42<(-8)的天数>=1 AND XA_42<=0 AND 统计4日中满足XA_42<=0的天数>=2}
XA_47:=XA_43 AND XA_44 AND XA_45 AND XA_46;{满足XA_43---- XA_46条件}
XA_48:=XA_47 AND COUNT(XA_47,10)=1;{XA_47 AND 统计10日中满足XA_47的天数=1}
XA_49:=REF(CLOSE,1);{昨日收盘价}
XA_50:=SMA(MAX(CLOSE-XA_49,0),7,1)/SMA(ABS(CLOSE-XA_49),7,1)*100;{收盘价-XA_49和0的较大值的7日[1日权重]移动平均/收盘价-XA_49的绝对值的7日[1日权重]移动平均*100}
XA_51:=SMA(MAX(CLOSE-XA_49,0),13,1)/SMA(ABS(CLOSE-XA_49),13,1)*100;{收盘价-XA_49和0的较大值的13日[1日权重]移动平均/收盘价-XA_49的绝对值的13日[1日权重]移动平均*100}
XA_52:=BARSLAST(XA_51<20)<=3 AND CROSS(XA_50,XA_51);{上次XA_51<20距今天数<=3 AND XA_50上穿XA_51}
XA_53:=(CLOSE-MA(CLOSE,20))/MA(CLOSE,20)*100<(-12.5);{(收盘价-收盘价的20日简单移动平均)/收盘价的20日简单移动平均*100<(-12.5)}
XA_54:=LLV(LOW,5);{5日内最低值}
XA_55:=HHV(HIGH,5);{5日内最高值}
XA_56:=EMA((CLOSE-XA_54)/(XA_55-XA_54)*100,4);{(收盘价-XA_54)/(XA_55-XA_54)*100的4日指数移动平均}
XA_57:=EMA(0.667*REF(XA_56,1)+0.333*XA_56,2);{0.667*1日前的XA_56+0.333*XA_56的2日指数移动平均}
XA_58:=XA_52 AND XA_53 AND CROSS(XA_56,XA_57) AND XA_56<=25;{XA_52 AND XA_53 AND XA_56上穿XA_57 AND XA_56<=25}
XA_59:=DMA(EMA(CLOSE,14),SUM(VOL,5)/3/CAPITAL);{以成交量(手)的5日累和/3/当前流通股本(手)为权重收盘价的14日指数移动平均的动态移动平均}
XA_60:=(CLOSE-XA_59)/XA_59*100;{(收盘价-XA_59)/XA_59*100}
XA_61:=XA_60<(-38);{XA_60的值小于-38}
XA_62:=DMA(EMA(CLOSE,12),SUM(VOL,5)/3/CAPITAL);{以成交量(手)的5日累和/3/当前流通股本(手)为权重收盘价的12日指数移动平均的动态移动平均}
XA_63:=(CLOSE-XA_62)/XA_62*100;{(收盘价-XA_62)/XA_62*100}
XA_64:=REF(XA_63,1)<(-37) AND XA_63>REF(XA_63,1) AND REF(XA_63,1)<REF(XA_63,2) AND REF(XA_63,2)-REF(XA_63,1)>1;
{1日前的XA_63<(-37) AND XA_63>1日前的XA_63 AND 1日前的XA_63<2日前的XA_63 AND 2日前的XA_63-1日前的XA_63>1}
XA_65:=XA_61 OR XA_64 AND VOL/CAPITAL*100<6;{A_61 或者 XA_64 且 成交量(手)占当前流通股本(手)的比例小于6%}
XA_66:=XA_65 AND COUNT(XA_65,10)=1;{XA_65 且 统计10日中满足XA_65的天数=1}
XA_67:=(HIGH-LOW)/HIGH*100+(CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100;{(最高价-最低价)/最高价*100+(收盘价-1日前的收盘价)/1日前的收盘价*100}
XA_68:=EMA(MA(XA_67,50),5);{XA_67的简单50日均值做5天的指数移动平均}
XA_69:=XA_68>LLV(XA_68,5)*1.01 AND REF(XA_68,1)<REF(LLV(XA_68,5),1)*1.01 AND LLV(XA_68,50)=LLV(XA_68,5);
{XA_68大于5日内最低的XA_68之上的10% 并且 昨日的XA_68小于从昨天计算XA_68的5日内最低值之上的10% 并且 50天的XA_68的最低值与5天的XA_68的值相等(最近走出的新低))}
XA_70:=LLV(LOW,5)=LLV(LOW,50) AND LLV(LOW,5)<HHV(LOW,70)*0.5;{5日最低价和50日的最低价相等,且5日的最低价小于70根K线里所有最低价中的最高值*0.5}
XA_71:=XA_69 AND XA_70;{满足XA_60和XA_70的条件}
XA_72:=XA_48 OR XA_58 OR XA_66 OR XA_71 AND XA_37;{满足XA_48或者满足XA_58或者满足XA_66或者满足XA_71且满足XA_37}
XA_73:=CLOSE/REF(CLOSE,1)>1.05 AND CLOSE=HIGH AND BETWEEN(FORCAST(VOL,4),0.2*FORCAST(VOL,12),2.1*FORCAST(VOL,12));
{收盘价/1日前的收盘价>1.05 AND 收盘价=最高价 AND 成交量(手)的4日线性回归预测值位于0.2*成交量(手)的12日线性回归预测值和2.1*成交量(手)的12日线性回归预测值之间}
XA_74:=FILTER(XA_73,28)*100;{XA_73的28日过滤*100}
XA_75:=IF(CLOSE/REF(CLOSE,1)>1.05 AND HIGH/CLOSE<1.01 AND CLOSE>REF(CLOSE,1),91,0);{如果收盘价/1日前的收盘价>1.05ANDHIGH/收盘价<1.01ANDCLOSE>1日前的收盘价,返回91,否则返回0}
XA_76:=FILTER(XA_75>90,45) AND FILTER(XA_75>90,35) AND XA_74>0;{XA_75>90的45日过滤 AND XA_75>90的35日过滤 AND XA_74>0}
XA_77:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);{如果收盘价>1日前的收盘价,返回成交量(手),否则返回-成交量(手)}
XA_78:=SUM(IF(CLOSE=REF(CLOSE,1),0,XA_77),0);{如果收盘价=1日前的收盘价,返回0,否则返回XA_77的历史累和}
XA_79:=HHV(XA_78,0);{0日内XA_78的最高值}
XA_80:=20;{XA_80=20}
XA_81:=MA(CLOSE,55);{55日均线}
XA_82:=(CLOSE-XA_81)/XA_81*100;{(收盘价-XA_81)/XA_81*100}
XA_83:=55;{XA_83=55}
XA_84:=XA_80+XA_83;{XA_84=75}
XA_85:=(CONST(REF(HHV(XA_82,XA_83),XA_80))/100+1)*XA_81;{(XA_80日前的XA_83日内XA_82的最高值的最后一日取值设为常数/100+1)*XA_81}
XA_86:=(CONST(LLV(XA_82,XA_84))/100+1)*XA_81;{(XA_84日内XA_82的最低值的最后一日取值设为常数/100+1)*XA_81}
XA_87:=(XA_86+XA_85)/2;{(XA_86+XA_85)/2}
XA_88:=CLOSE/REF(CLOSE,1)>=1.094 AND CLOSE=HIGH AND HIGH>LOW;{收盘价/1日前的收盘价>=1.094 AND 收盘价=最高价 AND 最高价>最低价}
妖股:XA_25 AND CLOSE/REF(CLOSE,1)>1.095 AND XA_28 AND NOT(OPEN>=REF(CLOSE,1)*1.096) AND XA_78=XA_79 AND REF(XA_79,1)>REF(XA_78,1) AND CROSS(CLOSE,XA_32) AND CROSS(CLOSE,XA_33) AND CLOSE/REF(CLOSE,1)>1.095 AND CLOSE=HIGH AND XA_76 AND COUNT(XA_76,60)=1,COLORRED;
{满足XA_25 且 收盘价相较于昨日上涨9.5%以上且满足XA_28 且 不能高开将近涨停且 XA_78=XA_79 且昨天的XA_79大于昨天的XA_78且收盘价上穿XA_32 且收盘价上穿XA_33 且 收盘价相较于昨日收盘价涨幅大于9.5% 且收盘价=最高价 且 满足XA_76 且 60日中满足XA_76的天数=1,画红线}
抄底:LOW<=XA_86 AND COUNT(LOW<=XA_86,BARSLAST(妖股))=1 AND BARSLAST(妖股)>2,COLORCYAN;
{最低价小于等于XA_86 且 统计上次妖股距今天数日中满足最低价<=XA_86的天数=1 且 上次妖股距今天数>2,画青色}
加仓:XA_88 AND COUNT(XA_88,BARSLAST(妖股))=1 AND LOW<=XA_87 AND BARSLAST(妖股)>5,COLORMAGENTA;
{XA_88 且 统计上次妖股距今天数日中满足XA_88的天数=1 且 最低价<=XA_87 且 上次妖股距今天数>5,画洋红色}
STICKLINE(妖股,0.2,0.45,8,0),COLORRED;
STICKLINE(妖股,0.45,0.72,8,0),COLORYELLOW;
STICKLINE(妖股,0.72,1,8,0),COLORMAGENTA;
DRAWTEXT(妖股,0.4,'妖股'),COLORYELLOW;
STICKLINE(抄底,0.2,0.45,8,0),COLORCYAN;
STICKLINE(抄底,0.45,0.72,8,0),COLORYELLOW;
STICKLINE(抄底,0.72,1,8,0),COLORRED;
DRAWTEXT(抄底,0.67,'抄底'),COLORCYAN;
STICKLINE(加仓,0.2,0.45,8,0),COLORMAGENTA;
STICKLINE(加仓,0.45,0.72,8,0),COLORRED;
STICKLINE(加仓,0.72,1,8,0),COLORYELLOW;
DRAWTEXT(加仓,0.95,'加仓'),COLORMAGENTA;