From ea2437193021fbb0e0cc8c11ef3ffc07e2dacdd3 Mon Sep 17 00:00:00 2001 From: jackyu66git Date: Wed, 1 Oct 2025 03:27:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4macd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChanLun.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ChanLun.py b/ChanLun.py index 7606a15..f10476f 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -52,6 +52,7 @@ class ChanLun(): self.time_symbols = ['1m', '3m', '5m', '10m', '15m', '30m', '1h', '2h', '4h', '6h', '8h', '12h', '16h', '1d', '2d', '3d', '1w', '2w', '1M', '3M', '6M', '1y'] self.tf_df_dict = {} self.ema_symbols = ['1m', '3m', '5m', '10m', '15m', '30m', '1h', '2h', '4h', '6h', '8h', '12h', '16h', '1d', '2d', '3d'] + self.tf_df = None def init_data(self, dataframe, intervals, timeframes): for index in range(0, len(intervals)): timeframe = timeframes[index] @@ -83,14 +84,14 @@ class ChanLun(): def check_fx(self, klc): if klc.pre and klc.next: if klc.high > klc.pre.high and klc.high > klc.next.high: - if klc.close > klc.ema52 or klc.next.close > klc.next.ema52: + if (klc.close > klc.ema52 or klc.next.close > klc.next.ema52) and klc.macd > 0: 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 + #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time, klc.macd, klc.state, klc.fx, "TOP") + return Chan_FX_TYPE.TOP elif klc.low < klc.pre.low and klc.low < klc.next.low: - if klc.close < klc.ema52 or klc.next.close < klc.next.ema52: + if (klc.close < klc.ema52 or klc.next.close < klc.next.ema52) and klc.macd < 0: 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") + #print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time, klc.macd, klc.state, klc.fx, "BOTTOM") return Chan_FX_TYPE.BOTTOM return Chan_FX_TYPE.UNKNOWN def add_indicators(self, df):