From b843e30ed88e1afb6f9d9b6c98e993fa866ea7df Mon Sep 17 00:00:00 2001 From: jackyu66git Date: Fri, 25 Jul 2025 01:22:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0k=E7=BA=BF=E5=8A=A8=E8=83=BD?= =?UTF-8?q?=E7=90=86=E8=AE=BA=E7=AC=AC=E4=B8=80=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChanKLC.py | 13 ++++++++++++- ChanLun.py | 4 ++-- web/app.py | 6 +++--- web/templates/index.html | 4 ++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChanKLC.py b/ChanKLC.py index f572c1f..4601a08 100644 --- a/ChanKLC.py +++ b/ChanKLC.py @@ -43,6 +43,8 @@ class ChanKLC(): self.last_top_klc = None self.last_bottom_klc = None self.bb_out = False + self.macd = 0 + self.signal = 0 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): @@ -75,7 +77,13 @@ class ChanKLC(): self.bb_out = True if self.low <= klu.bblow30 and klu.bblow30 > 0: self.klc_fx_type = Chan_KLC_FX.BOTTOM4 - #self.bb_out = True + if self.fx ==Chan_FX_TYPE.TOP: + if self.macd > 0: + self.bb_out = True + else: + if self.fx == Chan_FX_TYPE.BOTTOM: + if self.macd < 0: + self.bb_out = True def cal_indicators(self): for index in range(1, len(self.klus)): self.volume += self.klus[index].volume @@ -86,6 +94,9 @@ class ChanKLC(): self.volume_ratio = self.volume_ratio / len(self.klus) self.volume = self.volume / len(self.klus) self.macdhist = self.macdhist / len(self.klus) + if len(self.klus) > 0: + self.macd = self.klus[-1].macd + self.signal = self.klus[-1].signal def cal_shape_1(self): for index in range(1, len(self.klus)): self.body += self.klus[index].body diff --git a/ChanLun.py b/ChanLun.py index bca059a..7ea6eff 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -817,7 +817,7 @@ class ChanLun(): #klc.set_state("20") bi_list[-1].add_klc(klc) klc.set_bi(bi_list[-1]) - klc.set_klc_fx_type(Chan_KLC_FX.TOP3) + #klc.set_klc_fx_type(Chan_KLC_FX.TOP3) klc.set_last_top_klu(last_top) #print(klc.start_time, klc.fx, "二类卖点Sell 1") else: @@ -938,7 +938,7 @@ class ChanLun(): #klc.set_state("-20") bi_list[-1].add_klc(klc) klc.set_bi(bi_list[-1]) - klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM3) + #klc.set_klc_fx_type(Chan_KLC_FX.BOTTOM3) klc.set_last_bottom_klc(last_bottom) #print(last_bottom.start_time, last_bottom.end_time, "--------------------------------1") #print(klc.start_time, klc.fx, "二类买点Buy 1") diff --git a/web/app.py b/web/app.py index bbf1c66..2c34fd9 100644 --- a/web/app.py +++ b/web/app.py @@ -255,9 +255,9 @@ def get_a_stock_kl_data(symbol, timeframe, limit=1000, start_time=None, end_time return None def add_indicators(df): - fast = 8 - slow = 16 - period = 6 + fast = 12 + slow = 26 + period = 9 macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period) df['macd'] = macd['macd'] diff --git a/web/templates/index.html b/web/templates/index.html index 1359660..24aeb72 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -4379,7 +4379,7 @@ if (fx.fx_strength < 1.0) { // 降低阈值,让更多分型显示 displayText = fx.fx_strength >= 1.5 ? '' : '' // 0.8以上显示点,0.8以下不显示文本 } - displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("1", "").replace("2", "").replace("3", ""); + displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("11", "").replace("12", "").replace("13", ""); // 添加标记配置 const markerConfig = { time: timestamp, @@ -4520,7 +4520,7 @@ if (fx.fx_strength < 2.0){ // 调整小周期阈值 displayText = fx.fx_strength >= 1.5 ? '' : '' // 0.6以上显示点 } - displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("1", "").replace("2", "").replace("3", ""); + displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("11", "").replace("21", "").replace("13", ""); // 小周期KLU分型标记配置 const markerConfig = { time: timestamp,