问财量化选股策略逻辑
该策略的逻辑如下:
- 选取至少5根均线重合的股票,这表明股票的短期和中期趋势较为一致,有利于后续的走势。
- 要求换手率大于2%且小于9%,这表明该股票的流动性较好,且不是过度交易的股票。
- 要求10日涨幅大于0小于35%,这表明该股票近期有一定的上涨趋势,但尚未出现过大幅度的涨幅。
选股逻辑分析
该策略的逻辑较为简单,主要通过选取均线重合、换手率适中和近期有上涨趋势的股票来筛选出潜在的投资机会。这些条件可以帮助投资者筛选出较为稳健的股票,降低投资风险。
有何风险?
该策略的局限性在于,它只能筛选出一些短期趋势较为一致的股票,而不能预测股票的长期走势。此外,如果市场出现较大的波动,该策略可能会筛选出一些表现不佳的股票。因此,在实际操作中,投资者还需要结合其他因素进行综合分析,以降低投资风险。
如何优化?
为了优化该策略,投资者可以考虑增加更多的筛选条件,例如考虑股票的盈利能力、财务状况等因素。此外,投资者还可以通过使用量化交易软件或平台来实现更高效的筛选和交易。
最终的选股逻辑
以下是最终的选股逻辑:
- 选取至少5根均线重合的股票,这表明股票的短期和中期趋势较为一致,有利于后续的走势。
- 要求换手率大于2%且小于9%,这表明该股票的流动性较好,且不是过度交易的股票。
- 要求10日涨幅大于0小于35%,这表明该股票近期有一定的上涨趋势,但尚未出现过大幅度的涨幅。
- 要求股票的盈利能力较强,财务状况较好,有一定的成长潜力。
python代码参考
以下是参考代码:
import talib
def get_sma(n):
return talib.SMA(prices, timeperiod=n)
def get_macd(close_prices, fast_period=12, slow_period=26, signal_period=9):
emafast = talib.EMA(close_prices, timeperiod=fast_period)
emaslow = talib.EMA(close_prices, timeperiod=slow_period)
emasignal = talib.EMA(close_prices, timeperiod=signal_period)
return emafast, emaslow, emasignal
def get_bollinger Bands(prices, n):
upper = talib.BBANDS(prices, timeperiod=n, upperband=2, middleband=1, lowerband=-2)
lower = talib.BBANDS(prices, timeperiod=n, upperband=-2, middleband=1, lowerband=-2)
return upper, lower
def get_rsi(prices, n):
rsi = talib.RSI(prices, timeperiod=n)
return rsi
def get_rolling_mean(prices, n):
return talib.ROCP(prices, timeperiod=n)
def get_rolling_std(prices, n):
return talib.ROCS(prices, timeperiod=n)
def get_price_diff(prices, n):
return prices.diff(n)
def get_filter_signal(prices, emafast, emaslow, emasignal, rsi, rolling_mean, rolling_std, n):
filter_signal = (emafast > emaslow) and (emafast > emasignal) and (rsi < 30) and (rolling_mean > rolling_std)
return filter_signal
def get_final_filter_signal(prices, n):
emafast, emaslow, emasignal = get_macd(prices, fast_period=n, slow_period=n, signal_period=n)
rsi = get_rsi(prices, n)
rolling_mean = get_rolling_mean(prices, n)
rolling_std = get_rolling_std(prices, n)
filter_signal = get_filter_signal(prices, emafast, emaslow, emasignal, rsi, rolling_mean, rolling_std, n)
return filter_signal
该代码中,get_sma、get_macd、get_bollinger Bands、get_rsi、get_rolling_mean、get_rolling_std、get_price_diff、get_filter_signal和get_final_filter_signal函数分别用于计算简单移动平均线、MACD指标、布林线、RSI指标、滚动平均线、滚动标准差、价格差、过滤信号和最终过滤信号。其中,get_filter_signal函数用于根据多个指标的组合来筛选股票,get_final_filter_signal函数用于根据最终的过滤信号
如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。
select_sentence = '市值小于100亿' #选股语句。
模板如何使用?
点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。
如果有任何问题请添加 下方的二维码进群提问。


