waditu / czsc

缠中说禅技术分析工具;缠论;股票;期货;Quant;量化交易
Other
2.72k stars 943 forks source link

【check_bi函数】查找极值时根据min_bi_len过滤 #97

Open urna opened 2 years ago

urna commented 2 years ago

check_bi函数查找极值时 `min_bi_len = envs.get_min_bi_len() fxs = check_fxs(bars) if len(fxs) < 2: return None, bars

fx_a = fxs[0]
try:
    if fxs[0].mark == Mark.D:
        direction = Direction.Up
        fxs_b = [x for x in fxs if x.mark == Mark.G and x.dt > fx_a.dt and x.fx > fx_a.fx]
        if not fxs_b:
            return None, bars

        fx_b = fxs_b[0]
        for fx in fxs_b:
            if fx.high >= fx_b.high:
                fx_b = fx

    elif fxs[0].mark == Mark.G:
        direction = Direction.Down
        fxs_b = [x for x in fxs if x.mark == Mark.D and x.dt > fx_a.dt and x.fx < fx_a.fx]
        if not fxs_b:
            return None, bars

        fx_b = fxs_b[0]
        for fx in fxs_b[1:]:
            if fx.low <= fx_b.low:
                fx_b = fx`

是不是缺了用min_bi_len过滤? 否则如图片 Screenshot from 2022-07-31 16-03-52 这样的,第二根K线和导数第二根K线,就无法连城笔,因为第3根最长,查找的时候总是把它找出来,可它又不满足 >= min_bi_len 条件