From a56052e768e3e0d3cccf38714d5ab421904228fc Mon Sep 17 00:00:00 2001 From: jackyu66git Date: Sun, 6 Jul 2025 17:45:31 +0800 Subject: [PATCH] Add BB --- ChanLun.py | 8 ++++++++ strategies/ChanLun_BTC_30.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/ChanLun.py b/ChanLun.py index 786765e..77f0087 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -1323,6 +1323,14 @@ class ChanLun(): slow = 16 period = 6 macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period) + bb365 = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0) + bbp365 = ta.BBP(df, timeperiod=365) + bb120 = ta.BBANDS(df, timeperiod=120, nbdevup=3.0, nbdevdn=3.0, matype=0) + bbp120 = ta.BBP(df, timeperiod=120) + df['bb365'] = bb365['upperband'] + df['bbp365'] = bbp365 + df['bb120'] = bb120['upperband'] + df['bbp120'] = bbp120 df['macd'] = macd['macd'] df['macdsignal'] = macd['macdsignal'] df['macdhist'] = macd['macdhist'] diff --git a/strategies/ChanLun_BTC_30.py b/strategies/ChanLun_BTC_30.py index abd3e3c..432d278 100644 --- a/strategies/ChanLun_BTC_30.py +++ b/strategies/ChanLun_BTC_30.py @@ -153,6 +153,13 @@ class ChanLun_BTC_30(IStrategy): slow = 16 period = 6 macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period) + bb365 = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0) + bbp365 = ta.BBP(df, timeperiod=365) + bb120 = ta.BBANDS(df, timeperiod=120, nbdevup=3.0, nbdevdn=3.0, matype=0) + bbp120 = ta.BBP(df, timeperiod=120) + df['bb365'] = bb365['upperband'] + df['bbp365'] = bbp365 + df['bb120'] = bb120['upperband'] df['macd'] = macd['macd'] df['macdsignal'] = macd['macdsignal'] df['macdhist'] = macd['macdhist']