kc
Calculate the Keltner Channels.
Keltner Channels are volatility-based bands that are placed on either side of an asset's price and can aid in determining the direction of a trend.The Keltner channel uses the average true range (ATR) or volatility, with breaks above or below the top and bottom barriers signaling a continuation.
Example:
from openbb import obb
stock_data = obb.equity.price.historical(symbol="TSLA", start_date="2023-01-01", provider="fmp")
kc_data = obb.technical.kc(data=stock_data.results, length=20, scalar=20, mamode="ema", offset=0)
Parameters
- Standard
| Name | Type | Description | Default | Optional |
|---|---|---|---|---|
| data | List[Data] | The data to use for the Keltner Channels calculation. | None | False |
| index | str | Index column name to use with data, by default "date" | date | True |
| length | PositiveInt | The length of the Keltner Channels, by default 20 | 20 | True |
| scalar | PositiveFloat | The scalar to use for the Keltner Channels, by default 20 | 20 | True |
| mamode | Literal["ema", "sma", "wma", "hma", "zlma"] | The moving average mode to use for the Keltner Channels, by default "ema" | ema | True |
| offset | NonNegativeInt | The offset to use for the Keltner Channels, by default 0 | 0 | True |
Returns
The Keltner Channels data.