Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 271c9a8

Browse files
authored
Merge pull request #58 from Jrenk/feature/bbands-std-deviation
feat(BBANDS): added possibility to change the factor of the standard …
2 parents 36fc4de + 64f3d90 commit 271c9a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

finta/finta.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ def SAR(cls, ohlc: DataFrame, af: int = 0.02, amax: int = 0.2) -> Series:
714714

715715
@classmethod
716716
def BBANDS(
717-
cls, ohlc: DataFrame, period: int = 20, MA: Series = None, column: str = "close"
717+
cls, ohlc: DataFrame, period: int = 20, MA: Series = None, column: str = "close", std_multiplier: int = 2
718718
) -> DataFrame:
719719
"""
720720
Developed by John Bollinger, Bollinger Bands® are volatility bands placed above and below a moving average.
@@ -732,8 +732,8 @@ def BBANDS(
732732
else:
733733
middle_band = pd.Series(MA, name="BB_MIDDLE")
734734

735-
upper_bb = pd.Series(middle_band + (2 * std), name="BB_UPPER")
736-
lower_bb = pd.Series(middle_band - (2 * std), name="BB_LOWER")
735+
upper_bb = pd.Series(middle_band + (std_multiplier * std), name="BB_UPPER")
736+
lower_bb = pd.Series(middle_band - (std_multiplier * std), name="BB_LOWER")
737737

738738
return pd.concat([upper_bb, middle_band, lower_bb], axis=1)
739739

0 commit comments

Comments
 (0)