修改bb取值

This commit is contained in:
jackyu66git
2025-07-06 10:17:34 +08:00
parent aab41b4cf7
commit da2ee3bb45
2 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -270,7 +270,7 @@ def add_indicators(df):
df['rsi'] = ta.RSI(df, timeperiod=14)
# 计算布林带 (当前周期 - 20周期,2标准差)
bb = ta.BBANDS(df, timeperiod=20, nbdevup=2.0, nbdevdn=2.0, matype=0)
bb = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0)
df['bb_upper'] = bb['upperband'].fillna(0)
df['bb_middle'] = bb['middleband'].fillna(0)
df['bb_lower'] = bb['lowerband'].fillna(0)