问财量化选股策略逻辑
选股逻辑:选取RSI小于65、换手率在3%-12%之间、代码以60开头的股票作为投资标的。
选股逻辑分析
该选股逻辑结合了技术面、市场热度和股票特征,筛选出近期上市且有一定流动性的可投资标的,并结合了技术指标对股票进行筛选,具有一定市场可行性。
有何风险?
该选股策略可能会过度追求短期利润,而忽略基本面和长期趋势,存在机会成本和风险管理不足的问题。同时,仅以代码以60开头的股票为选股依据,可能会忽略一些潜力股。
如何优化?
- 增加基本面分析和长期趋势分析,结合技术面分析综合判断;
- 优化涨停板判断机制,尽可能避免过度倚重短期热度;
- 考虑扩大选股股票池范围,适当放宽选股条件。
最终的选股逻辑
选取RSI小于65、换手率在3%-12%之间、代码以60开头的股票作为投资标的。
同花顺指标公式代码参考
选股策略中使用的通达信公式代码如下:
RSI(CLOSE,14)<65 AND VOL/REF(VOL,1)>=0.03 AND VOL/REF(VOL,1)<=0.12 AND LEFT(STOCKCODE, 2)==60
python代码参考
以下是Python代码示例,仅供参考。
import tushare as ts
import pandas as pd
import numpy as np
def select_stocks():
res = []
for code in ts.get_stock_basics().index:
try:
if not code.startswith('60'):
continue
# 上市时间
year = int(str(ts.get_stock_basics().loc[code]['timeToMarket'])[:4])
if year != 2021:
continue
# 行情数据
hist_data = ts.get_hist_data(code)
if hist_data is None:
continue
close_data = hist_data['close'].values
high_data = hist_data['high'].values
low_data = hist_data['low'].values
if len(close_data) < 26:
continue
# RSI
rsi_threshold = 65
rsi = talib.RSI(close_data)[-1]
if rsi >= rsi_threshold:
continue
# 量比
vol_threshold = (0.03, 0.12)
turnover_rate = hist_data['volume'][-1] / hist_data['volume'][0]
if turnover_rate < vol_threshold[0] or turnover_rate > vol_threshold[1]:
continue
res.append(code)
except Exception as e:
continue
return res
# 选取符合要求的股票
res = select_stocks()
print(res)
注:在使用该代码时,请遵守国家法律法规和相关规定,严禁私自开展证券投资活动,自行承担相应风险。
## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。
select_sentence = '市值小于100亿' #选股语句。
模板如何使用?
点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。
## 如果有任何问题请添加 下方的二维码进群提问。


