Skip to main content

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​

NameTypeDescriptionDefaultOptional
dataList[Data]The data to use for the Keltner Channels calculation.False
indexstrIndex column name to use with data, by default "date"dateFalse
lengthintThe length of the Keltner Channels, by default 2020False
scalarfloatThe scalar to use for the Keltner Channels, by default 2020False
mamodeLiteral['ema', 'sma', 'wma', 'hma', 'zlma']The moving average mode to use for the Keltner Channels, by default "ema"emaFalse
offsetintThe offset to use for the Keltner Channels, by default 00False

Returns​

OBBject
results : List[Data]
The Keltner Channels data.