通达信选股公式简介:
黄钻三箭选股公式结合了多种技术指标和条件来筛选潜在的股票买入信号。代码中包含了EMA(指数移动平均)、WINNER函数(盈利者比例)、成交量分析、价格动量等多个因素。通过这些条件的组合,代码旨在识别出股票价格的强势启动点,为投资者提供买入的参考。代码还考虑了日期因素,以适应不同市场环境下的交易策略。最终,代码通过XG标签输出满足所有条件的股票信号。
公式效果图:
指标源码及源码注释:
X_1:=EMA(WINNER(CLOSE)*70,3);{计算收盘价的盈利者比例乘以70的3日指数移动平均}
X_2:=EMA((WINNER(CLOSE*1.1)-WINNER(CLOSE*0.9))*80,3);{计算收盘价上下10%的盈利者比例差的8日指数移动平均}
X_4:=X_1/(X_1+X_2)*100;{计算X_1占X_1和X_2之和的比例}
X_6:=EMA(X_4,55);{计算X_4的55日指数移动平均}
X_8:=DYNAINFO(4)>0 AND HHV(HIGH,10)/LLV(LOW,10)<1.25 AND REF(CLOSE,1)<LLV(LOW,15)+(HHV(HIGH,15)-LLV(LOW,15))*0.85 AND CLOSE>OPEN AND CLOSE>=HHV(HIGH,10);{多个条件的组合,包括动态信息、高低点比率等}
X_9:=IF(DATETODAY(DATE)<1000000000,1,1);{日期判断,若日期小于某个值则为1}
X_11:=EMA(CLOSE,10);{计算收盘价的10日指数移动平均}
X_14:=EMA(CLOSE,40);{计算收盘价的40日指数移动平均}
X_15:=EMA(CLOSE,60);{计算收盘价的60日指数移动平均}
X_16:=IF(DATE<1000000000,1,DRAWNULL);{日期判断,若日期小于某个值则为1,否则不绘制}
X_17:=MAX(X_14,X_15);{取X_14和X_15中的最大值}
X_18:=CLOSE>X_17 AND X_8 AND (CLOSE>REF(HHV(HIGH,3),1)*X_9 AND (CLOSE-REF(CLOSE,1))/REF(CLOSE,1)>0.07);{多个条件的组合,包括收盘价大于最高值等}
X_19:=VOL;{今日成交量}
X_20:=MA(X_19,5);{计算成交量的5日简单移动平均}
X_21:=X_20+X_20>X_19;{判断成交量是否大于其5日简单移动平均的两倍}
X_22:=DYNAINFO(4)>0 AND HHV(HIGH,10)/LLV(LOW,10)<1.25 AND REF(CLOSE,1)<(LLV(LOW,15)+(HHV(HIGH,15)-LLV(LOW,15))*0.85)*X_9 AND CLOSE>OPEN AND CLOSE>=HHV(HIGH,10)*X_16;{多个条件的组合,包括动态信息、高低点比率等}
X_23:=(CLOSE>REF(HHV(HIGH,3),1)*X_9 AND (CLOSE-REF(CLOSE,1))/REF(CLOSE,1)>0.07)*X_9 AND X_22 AND X_21;{多个条件的组合,包括收盘价大于最高值等}
X_24:=DYNAINFO(4)>0 AND HHV(HIGH,10)/LLV(LOW,10)<1.25 AND REF(CLOSE,1)*X_9<LLV(LOW,15)+(HHV(HIGH,15)-LLV(LOW,15))*0.85 AND CLOSE>OPEN AND CLOSE>=HHV(HIGH,10);{多个条件的组合,包括动态信息、高低点比率等}
X_25:=(CLOSE-REF(CLOSE,1)*X_9)/REF(CLOSE,1)*100>7;{计算收盘价相比前一日收盘价上涨超过7%}
X_26:=X_24 AND X_25;{多个条件的组合}
X_27:=DATETODAY(DATE);{将日期转换为数值}
X_28:=X_27>9344 AND X_27<1000000000;{日期范围判断}
X_29:=(X_18 AND X_26)*X_28;{多个条件的组合}
X_30:=EMA(CLOSE,5);{计算收盘价的5日指数移动平均}
X_32:=EMA(CLOSE,14);{计算收盘价的14日指数移动平均}
X_33:=EMA(CLOSE,18);{计算收盘价的18日指数移动平均}
X_34:=EMA(CLOSE,40);{计算收盘价的40日指数移动平均}
X_35:=EMA(CLOSE,60);{计算收盘价的60日指数移动平均}
X_36:=MAX(MAX(MAX(MAX(MAX(X_30,X_11),X_32),X_33),X_34),X_35)*X_16;{取多个指数移动平均值的最大值}
X_37:=MIN(MIN(MIN(MIN(MIN(X_30,X_11),X_32),X_33),X_34),X_35)*X_16;{取多个指数移动平均值的最小值}
X_38:=CLOSE>X_36 AND LOW<X_37 AND (CLOSE>REF(HHV(HIGH,3),1) AND (CLOSE-REF(CLOSE,1)*X_9)/REF(CLOSE,1)>0.09);{多个条件的组合,包括收盘价大于最高值等}
X_39:=FILTER(X_38>0,0)=1;{过滤条件}
X_40:=DATETODAY(DATE);{将日期转换为数值}
X_41:=X_40>9350 AND X_40<1000000000;{日期范围判断}
X_42:=X_39*X_41;{多个条件的组合}
X_43:=MA(REF(HHV(CLOSE,26),1),2);{计算收盘价26日最高值的2日简单移动平均}
X_44:=MA(CLOSE,26);{计算收盘价的26日简单移动平均}
X_45:=POW(CLOSE-X_44,2);{计算收盘价与26日简单移动平均差的平方}
X_46:=MA(X_45,13);{计算收盘价与26日简单移动平均差的平方的13日简单移动平均}
X_47:=SQRT(X_46);{计算平方根}
X_48:=X_44+2*X_47;{计算布林带上轨}
X_50:=CROSS(CLOSE,X_43) AND HIGH>REF(X_48,1) OR (CLOSE>X_43 AND CROSS(CLOSE,REF(X_48,1))) AND CLOSE/OPEN>0.998;{多个条件的组合,包括收盘价穿越}
X_51:=MACD.MACD;{计算MACD指标的MACD值}
X_52:=KD.K;{计算KDJ指标的K值}
X_53:=KD.D;{计算KDJ指标的D值}
X_54:=RSI.RSI1;{计算RSI指标的1日RSI值}
X_55:=RSI.RSI3;{计算RSI指标的3日RSI值}
X_56:=CLOSE-REF(CLOSE,1);{计算收盘价相比前一日的变化}
X_57:=IF(X_56>=0,X_56,0)*X_16;{若收盘价相比前一日为上涨,则取变化值,否则为0}
X_58:=IF(X_56<0,-X_56,0)*X_16;{若收盘价相比前一日为下跌,则取变化值的绝对值,否则为0}
X_59:=MEMA(X_57,10);{计算X_57的10日指数移动平均}
X_60:=MEMA(X_58,10);{计算X_58的10日指数移动平均}
X_61:=MEMA(X_57,6);{计算X_57的6日指数移动平均}
X_62:=MEMA(X_58,6);{计算X_58的6日指数移动平均}
X_63:=MA(100*X_59/(X_59+X_60),10)*X_16;
X_64:=MA(100*X_61/(X_61+X_62),6)*X_16;
X_65:=MA(CLOSE,5)/MA(CLOSE,10)>0.999 AND MA(CLOSE,10)/MA(CLOSE,20)>0.9847 AND MA(CLOSE,20)>MA(CLOSE,60) AND REF(COUNT(MA(CLOSE,10)/MA(CLOSE,20)<1.017 OR MA(CLOSE,5)/MA(CLOSE,10)<1.017,8)>=1,1) AND MA(CLOSE,20)/MA(CLOSE,60)<1.121;
X_66:=(CLOSE-MA(CLOSE,60))/MA(CLOSE,60)*100;
X_67:=COUNT(X_66<35,100)>=95;
X_68:=X_50 AND X_65>0 AND NOT(DYNAINFO(4)=0) AND X_67 AND REF(COUNT(MA(CLOSE,20)>MA(CLOSE,30),4)=4 AND COUNT(CLOSE>MA(CLOSE,5),3)>=2,1) AND VOL>REF(VOL,1) AND (REF(COUNT(CLOSE>OPEN,10)>=6 OR COUNT(CLOSE>OPEN,5)>=4,1) OR CLOSE=HIGH) AND (CROSS(X_64,X_63) OR CROSS(X_51,0) OR REF(COUNT(CROSS(X_51,0),3)=1 AND X_51<0.15 AND CLOSE/OPEN>0.989 AND CLOSE/REF(CLOSE,1)<1.03,1) OR CROSS(X_52,X_53) OR CROSS(X_54,X_55)) AND REF(CLOSE/OPEN>0.988 AND (CLOSE>OPEN OR (CLOSE<=OPEN AND HIGH/LOW<1.049)),1) AND HIGH/CLOSE<1.013 AND CLOSE/OPEN>1.05;
X_69:=X_18+X_23+X_26+X_39+X_68>=2;
X_70:=MA(CLOSE,5)>MA(CLOSE,10) AND MA(CLOSE,10)>MA(CLOSE,20) AND MA(CLOSE,20)>MA(CLOSE,60) AND MA(CLOSE,60)>MA(CLOSE,120) AND MA(CLOSE,5)>REF(MA(CLOSE,5),1);
X_71:=CLOSE>REF(CLOSE,1)*1.1-0.01;
X_72:=HHV(HIGH,20)=HHV(CLOSE,1) AND VOL>0 AND BARSCOUNT(CLOSE)*X_9>=20;
X_73:=VOL/REF(VOL,1)*X_9>1.9;
X_74:=X_70 AND X_71 AND X_72 AND X_73;
X_81:=CLOSE/REF(CLOSE,1)>1.05 AND REF(CLOSE,1)/REF(CLOSE,2)<1.05 AND CLOSE/LLV(CLOSE,10)<1.4;
X_82:=VOL/REF(VOL,1)>2 OR VOL=HHV(VOL,15);
X_83:=CAPITAL<10000000;{指标公式网WWW.GUKOUDAI.COM}
X_84:=ATAN((MA(CLOSE,5)/REF(MA(CLOSE,5),1)-1)*100)*57.299999>40;
X_85:=ATAN((MA(CLOSE,10)/REF(MA(CLOSE,10),1)-1)*100)*57.299999>30;
X_86:=ATAN((MA(CLOSE,20)/REF(MA(CLOSE,20),1)-1)*100)*57.299999>20;
X_87:=ATAN((MA(CLOSE,30)/REF(MA(CLOSE,30),1)-1)*100)*57.299999>10;
X_88:=X_84 AND X_85 AND X_86 AND X_87;
X_89:=KDJ.K>REF(KDJ.K,1)*X_9;
X_90:=KDJ.D>REF(KDJ.D,1)*X_9 AND KDJ.D<70;
X_91:=KDJ.J>REF(KDJ.J,1)*X_9;
X_92:=X_89 AND X_90 AND X_91;
X_93:=X_14 AND X_81 AND X_82 AND X_83 AND X_88 AND X_92;
X_94:=FILTER(X_93,15)*X_9;
X_95:=X_74 OR X_94;
X_96:=(X_95 AND X_69)*X_9 OR X_42 OR X_29;
X_99:=X_4>X_6 AND X_6>50;
X_100:=X_4>X_6 AND X_6<50 AND X_4>50 AND X_6>REF(X_6,1);
X_101:=X_99 OR X_100;
XG:X_96 AND X_101;