From 1a70bc294d9efcb99d52c466a8eecb730878bcc1 Mon Sep 17 00:00:00 2001 From: Porter Date: Tue, 16 Sep 2025 04:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AB=98=E4=BD=8D=E7=A9=BA?= =?UTF-8?q?=E5=88=A4=E6=96=ADtop=EF=BC=8Cbottom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChanEnum.py | 2 ++ ChanKLC.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChanEnum.py b/ChanEnum.py index 28865a8..581c45c 100644 --- a/ChanEnum.py +++ b/ChanEnum.py @@ -68,11 +68,13 @@ class Chan_KLC_FX(Enum): TOP3 = auto() TOP4 = auto() TOP5 = auto() + TOP6 = auto() BOTTOM1 = auto() BOTTOM2 = auto() BOTTOM3 = auto() BOTTOM4 = auto() BOTTOM5 = auto() + BOTTOM6 = auto() UNKNOWN = auto() # 统一的MACD状态枚举,包含所有可能的状态 class Chan_MACD_STATE(Enum): diff --git a/ChanKLC.py b/ChanKLC.py index 7f78429..35bbca5 100644 --- a/ChanKLC.py +++ b/ChanKLC.py @@ -45,6 +45,7 @@ class ChanKLC(): self.bb_out = True self.macd = 0 self.signal = 0 + self.state = Chan_MACD_STATE.UNKNOWN def set_last_top_klu(self, last_top_klc): self.last_top_klc = last_top_klc def set_last_bottom_klc(self, last_bottom_klc): @@ -67,6 +68,8 @@ class ChanKLC(): self.pre.cal_bb_out() def cal_bb_out(self): for klu in self.klus: + if klu.macd_state != Chan_MACD_STATE.UNKNOWN: + self.state = klu.macd_state if self.high >= klu.bbup302 and klu.bbup302 > 0 and (self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2): self.bb_out = True #print(self.end_time, self.high, klu.bbup302, self.klc_fx_type) @@ -81,12 +84,17 @@ class ChanKLC(): if self.macdhist < 0 and self.macd > 0: self.klc_fx_type = Chan_KLC_FX.TOP5 self.bb_out = True + if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd > 0: + #print(self.end_time, self.state, self.macd, self.klc_fx_type) + self.klc_fx_type = Chan_KLC_FX.TOP6 else: if self.fx == Chan_FX_TYPE.BOTTOM: if self.macdhist > 0 and self.macd < 0: self.klc_fx_type = Chan_KLC_FX.BOTTOM5 self.bb_out = True - + if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd < 0: + self.klc_fx_type = Chan_KLC_FX.BOTTOM6 + #print(self.end_time, self.state, self.macd, self.klc_fx_type) def cal_macd_state(self, dir): macd_state = 0 return macd_state