bbands
Calculate the Bollinger Bands for a given symbol.
Syntax
Fields
Description
symbol(str)
Symbol to perform calculation on. Defaults to the first symbol in watchlist
period(int)
Period of BBands. Defaults to 14
interval(str)
Interval to perform the calculation. Defaults to interval of algorithm
ref(str)
'close', 'open', 'high', or 'low'. Defaults to 'close'
dev(float)
Standard deviation of the bands. Defaults to 1.0
prices(list)
When specified, this function will use the values provided in the list to perform calculations and ignore other parameters. Defaults to None
def bbands(
self,
symbol: str = None,
period: int = 14,
interval: Interval = None,
ref: str = "close",
dev: float = 1.0,
prices=None,
) -> Tuple[np.array, np.array, np.array]:
Returns
Returns a tuple of NumPy arrays containing the Bollinger Bands top, average, and bottom values.
Raises
- An
Exception
is raised if the calculation fails due to incorrect parameters or data issues.