(同花顺量化)20日均线大于120日均线_、圆弧形、至少5根均线重合的股票

用户头像神盾局量子研究部
2023-08-31 发布

问财量化选股策略逻辑

  • 至少5根均线重合的股票
  • 圆弧形
  • 20日均线大于120日均线

选股逻辑分析

  • 5根均线重合的股票可能表明该股票价格在短期内有较强的支撑和阻力,有利于股票的稳定性和趋势延续性。
  • 圆弧形形态通常表示股票价格在一段时间内呈现上涨或下跌的趋势,但幅度逐渐减小,表明市场力量正在逐渐平衡。
  • 20日均线大于120日均线的股票可能表明该股票价格正在经历上涨趋势,短期内可能有一定的回调风险,但长期来看有望继续上涨。

有何风险?

  • 5根均线重合的股票可能表明市场力量相对平衡,不利于股票的爆发力和趋势延续性。
  • 圆弧形形态可能表明股票价格已经进入盘整阶段,短期内难以出现明显的趋势。
  • 20日均线大于120日均线的股票可能表明短期内股票价格存在回调风险,但长期来看有望继续上涨。

如何优化?

  • 可以考虑加入更多均线的组合,例如60日均线、90日均线等,以更好地反映市场力量的变化。
  • 可以考虑加入其他形态的判断,例如双底、头肩顶等,以更好地判断股票价格的趋势方向。
  • 可以考虑加入其他技术指标的判断,例如MACD、RSI等,以更好地判断股票价格的买卖时机。

最终的选股逻辑

  • 选取至少5根均线重合的股票
  • 选取圆弧形形态的股票
  • 选取20日均线大于120日均线的股票
  • 选取60日均线、90日均线组合的股票
  • 选取双底、头肩顶等形态的股票
  • 选取MACD、RSI等技术指标的股票

python代码参考

import talib

def get_ma_prices(prices, n):
    ma = talib.MA(prices, n)
    return ma

def get_ma_intersection(prices1, prices2, n):
    ma1 = get_ma_prices(prices1, n)
    ma2 = get_ma_prices(prices2, n)
    for i in range(n):
        if ma1[i] == ma2[i]:
            return i
    return None

def get_ma_rounded_prices(prices, n):
    ma = talib.MA(prices, n)
    rounded_ma = []
    for i in range(n):
        rounded_ma.append(round(ma[i], 2))
    return rounded_ma

def get_rounded_ma_intersection(prices1, prices2, n):
    ma1 = get_ma_rounded_prices(prices1, n)
    ma2 = get_ma_rounded_prices(prices2, n)
    for i in range(n):
        if ma1[i] == ma2[i]:
            return i
    return None

def get_strong_trend_prices(prices, n):
    ma = talib.MA(prices, n)
    strong_trend_prices = []
    for i in range(n):
        if ma[i] > ma[i-1] and ma[i] > ma[i-2]:
            strong_trend_prices.append(prices[i])
    return strong_trend_prices

def get_strong_trend_intersection(prices1, prices2, n):
    ma1 = talib.MA(prices1, n)
    ma2 = talib.MA(prices2, n)
    strong_trend_prices1 = get_strong_trend_prices(prices1, n)
    strong_trend_prices2 = get_strong_trend_prices(prices2, n)
    for i in range(n):
        if ma1[i] > ma1[i-1] and ma1[i] > ma1[i-2] and ma2[i] > ma2[i-1] and ma2[i] > ma2[i-2]:
            return i
    return None

def get_prices_with_rounded_ma_intersection(prices, n):
    ma = talib.MA(prices, n)
    rounded_ma = get_ma_rounded_prices(prices, n)
    intersection = get_rounded_ma_intersection(prices, ma, n)
    if intersection is not None:
        return intersection
    else:
        return None

def get_prices_with_strong_trend_intersection(prices, n):
    ma = talib.MA(prices, n)
    strong_trend_prices = get_strong_trend_prices(prices, n)
    intersection = get_strong_trend_intersection(prices, strong_trend_prices, n)
    if intersection is not None:
        return intersection
    else:

## 如何进行量化策略实盘?
请把您优化好的选股语句放入文章最下面模板的选股语句中即可。

select_sentence = '市值小于100亿' #选股语句。

模板如何使用?

点击图标右上方的复制按钮,复制到自己的账户即可使用模板进行回测。


## 如果有任何问题请添加 下方的二维码进群提问。
![94c5cde12014f99e262a302741275d05.png](http://u.thsi.cn/imgsrc/pefile/94c5cde12014f99e262a302741275d05.png)
收益&风险
源码

评论