From 275e644f5af4aed458f6ac1892954f40f287f8a7 Mon Sep 17 00:00:00 2001 From: Porter Date: Mon, 22 Sep 2025 10:16:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChanLun.py | 9 +++++---- TF_DF.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChanLun.py b/ChanLun.py index aa432ce..33952b6 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -32,10 +32,11 @@ class ChanLun(): time8h = 480 time12h = 720 time1d = 1440 - timeframes = [time1, time3, time5, time15] + timeframes = [time1, time3, time5, time15, time30, time60] + tf_df_dict = {} def init_data(self, dataframe, ticker_indicator): for timeframe in self.timeframes: - klu_list, klc_list, bi_list = self.get_list_by_time(dataframe, ticker_indicator, timeframe) + self.tf_df_dict[timeframe] = TF_DF(timeframe, dataframe, ticker_indicator) def calculate_bsp(self, dataframe, ticker_indicator): return dataframe @@ -54,14 +55,14 @@ class ChanLun(): if klc.high > klc.pre.high and klc.high > klc.next.high: if klc.pre.pre and klc.high > klc.pre.pre.high and klc.next.next and klc.high > klc.next.next.high: if klc.pre.pre.pre and klc.high > klc.pre.pre.pre.high and klc.next.next.next and klc.high > klc.next.next.next.high: - if klc.macd > 0 and klc.macd > klc.signal and klc.signal > klc.macdhist: + if klc.signal > 0 and klc.macd > klc.signal: klc.set_fx(Chan_FX_TYPE.TOP) #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP") return Chan_FX_TYPE.TOP elif klc.low < klc.pre.low and klc.low < klc.next.low: if klc.pre.pre and klc.low < klc.pre.pre.low and klc.next.next and klc.low < klc.next.next.low: if klc.pre.pre.pre and klc.low < klc.pre.pre.pre.low and klc.next.next.next and klc.low < klc.next.next.next.low: - if klc.macd < 0 and klc.macd < klc.signal and klc.signal < klc.macdhist: + if klc.signal < 0 and klc.macd < klc.signal: klc.set_fx(Chan_FX_TYPE.BOTTOM) #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM") return Chan_FX_TYPE.BOTTOM diff --git a/TF_DF.py b/TF_DF.py index 28e849c..3f2d7be 100644 --- a/TF_DF.py +++ b/TF_DF.py @@ -37,7 +37,8 @@ class TF_DF(): self.bi_list = self.cal_bi_list(self.klc_list) self.seg_list = self.cal_seg_list(self.bi_list) self.zs_list = self.cal_zs_list(self.bi_list, self.seg_list) - return True + self.chanmacd = ChanMACD(self.klu_list) + self.klu_list = self.chanmacd.cal_macd_state() def check_fx(self, klc): if klc.pre and klc.next: if klc.high > klc.pre.high and klc.high > klc.next.high: