From d69261446e2a4f7dd92d0af77b96dc8a4ea304f1 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 6 Oct 2024 10:10:56 +0800 Subject: [PATCH] 1 --- monitors/macd_boll.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitors/macd_boll.py b/monitors/macd_boll.py index b062886..9c03e15 100644 --- a/monitors/macd_boll.py +++ b/monitors/macd_boll.py @@ -36,8 +36,8 @@ def stratergy_run(symbol, interval, df, debug): upperband, middleband, lowerband = talib.BBANDS(df['close'], timeperiod=bollinger_length, nbdevup=bollinger_mult, nbdevdn=bollinger_mult, matype=0) # 生成交易信号 - long_condition = (macd.shift(1) <= 0) & (macd > 0) & (df['high'] < upperband) & (df['close'] > fast_ema | df['close'] > slow_ema) - short_condition = (macd.shift(1) >= 0) & (macd < 0) & (df['low'] > lowerband) & (df['close'] < fast_ema | df['close'] < slow_ema) + long_condition = (macd.shift(1) <= 0) & (macd > 0) & (df['high'] < upperband) & ((df['close'] > fast_ema) | (df['close'] > slow_ema)) + short_condition = (macd.shift(1) >= 0) & (macd < 0) & (df['low'] > lowerband) & ((df['close'] < fast_ema) | (df['close'] < slow_ema)) df['Long_Signal'] = np.where(long_condition, True, False)