refactor: Update BB calculation with ffill() and debug print
This commit is contained in:
parent
17e9024a3f
commit
c771e479bb
@ -80,10 +80,14 @@ class DynamicStrategy(Strategy):
|
|||||||
middle_col = bb_result.columns[1] # BBM
|
middle_col = bb_result.columns[1] # BBM
|
||||||
lower_col = bb_result.columns[0] # BBL
|
lower_col = bb_result.columns[0] # BBL
|
||||||
|
|
||||||
# Extract and process the values
|
# Extract and process the values using ffill() instead of fillna(method='ffill')
|
||||||
upper = bb_result[upper_col].fillna(method='ffill').fillna(0).values
|
upper = bb_result[upper_col].ffill().fillna(0).values
|
||||||
middle = bb_result[middle_col].fillna(method='ffill').fillna(0).values
|
middle = bb_result[middle_col].ffill().fillna(0).values
|
||||||
lower = bb_result[lower_col].fillna(method='ffill').fillna(0).values
|
lower = bb_result[lower_col].ffill().fillna(0).values
|
||||||
|
|
||||||
|
# Add debug print to verify values
|
||||||
|
if len(upper) > 0:
|
||||||
|
print(f"Debug BB values - Upper: {upper[-1]:.2f}, Middle: {middle[-1]:.2f}, Lower: {lower[-1]:.2f}")
|
||||||
|
|
||||||
return upper, middle, lower
|
return upper, middle, lower
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user