Skip to content

Commit

Permalink
0.9.54 新增信号
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Jun 26, 2024
1 parent 0bae08b commit 2f623b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions czsc/signals/tas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@ def cat_macd_V230518(cat: CzscSignals, **kwargs) -> OrderedDict:
# 找出 c1 的最近一次金叉
macd_gold_bars = []
for bar1, bar2 in zip(c1_bars, c1_bars[1:]):
if bar1.cache[cache_key]["macd"] < 0 and bar2.cache[cache_key]["macd"] > 0:
if bar1.cache[cache_key]["macd"] < 0 < bar2.cache[cache_key]["macd"]:
macd_gold_bars.append(bar2)
assert macd_gold_bars, "没有找到金叉"
macd_gold_bar = macd_gold_bars[-1]
Expand All @@ -3127,7 +3127,7 @@ def cat_macd_V230518(cat: CzscSignals, **kwargs) -> OrderedDict:
if len(c2_bars) > 3:
c2_gold_bars = []
for bar1, bar2 in zip(c2_bars, c2_bars[1:]):
if bar1.cache[cache_key]["macd"] < 0 and bar2.cache[cache_key]["macd"] > 0:
if bar1.cache[cache_key]["macd"] < 0 < bar2.cache[cache_key]["macd"]:
c2_gold_bars.append(bar2)

if len(c2_gold_bars) == 1:
Expand All @@ -3137,7 +3137,7 @@ def cat_macd_V230518(cat: CzscSignals, **kwargs) -> OrderedDict:
# 找出 c1 的最近一次死叉
macd_dead_bars = []
for bar1, bar2 in zip(c1_bars, c1_bars[1:]):
if bar1.cache[cache_key]["macd"] > 0 and bar2.cache[cache_key]["macd"] < 0:
if bar1.cache[cache_key]["macd"] > 0 > bar2.cache[cache_key]["macd"]:
macd_dead_bars.append(bar2)
assert macd_dead_bars, "没有找到死叉"
macd_dead_bar = macd_dead_bars[-1]
Expand All @@ -3147,7 +3147,7 @@ def cat_macd_V230518(cat: CzscSignals, **kwargs) -> OrderedDict:
if len(c2_bars) > 3:
c2_dead_bars = []
for bar1, bar2 in zip(c2_bars, c2_bars[1:]):
if bar1.cache[cache_key]["macd"] > 0 and bar2.cache[cache_key]["macd"] < 0:
if bar1.cache[cache_key]["macd"] > 0 > bar2.cache[cache_key]["macd"]:
c2_dead_bars.append(bar2)

if len(c2_dead_bars) == 1:
Expand Down
8 changes: 4 additions & 4 deletions czsc/signals/xls.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def xl_bar_basis_V240411(c: CZSC, **kwargs) -> OrderedDict:
def xl_bar_trend_V240623(c: CZSC, **kwargs) -> OrderedDict:
"""突破信号; 贡献者:谢磊
参数模板:"{freq}_N{n}_突破信号V240623"
参数模板:"{freq}_N{n}通道_突破信号V240623"
**信号逻辑:**
Expand All @@ -323,8 +323,8 @@ def xl_bar_trend_V240623(c: CZSC, **kwargs) -> OrderedDict:
**信号列表:**
- Signal('30分钟_N20_突破信号V240623_做多_连续2次上涨_任意_0')
- Signal('30分钟_N20_突破信号V240623_做空_连续2次下跌_任意_0')
- Signal('30分钟_N20通道_突破信号V240623_做多_连续2次上涨_任意_0')
- Signal('30分钟_N20通道_突破信号V240623_做空_连续2次下跌_任意_0')
:param c: CZSC对象
:param kwargs:
Expand All @@ -335,7 +335,7 @@ def xl_bar_trend_V240623(c: CZSC, **kwargs) -> OrderedDict:
"""
n = int(kwargs.get("n", 20))
freq = c.freq.value
k1, k2, k3 = f"{freq}_N{n}_突破信号V240623".split("_")
k1, k2, k3 = f"{freq}_N{n}通道_突破信号V240623".split("_")
v1 = "其他"
v2 = "任意"

Expand Down

0 comments on commit 2f623b9

Please sign in to comment.