kc#

API documentation for pandas_ta.volatility.kc Python function.

kc(high, low, close, length=None, scalar=None, mamode=None, offset=None, **kwargs)[source]#

Keltner Channels (KC)

A popular volatility indicator similar to Bollinger Bands and Donchian Channels.

Sources:

https://www.tradingview.com/wiki/Keltner_Channels_(KC)

Calculation:
Default Inputs:

length=20, scalar=2, mamode=None, tr=True

TR = True Range SMA = Simple Moving Average EMA = Exponential Moving Average

if tr:

RANGE = TR(high, low, close)

else:

RANGE = high - low

if mamode == “ema”:

BASIS = sma(close, length) BAND = sma(RANGE, length)

elif mamode == “sma”:

BASIS = sma(close, length) BAND = sma(RANGE, length)

LOWER = BASIS - scalar * BAND UPPER = BASIS + scalar * BAND

Args:

high (pd.Series): Series of ‘high’s low (pd.Series): Series of ‘low’s close (pd.Series): Series of ‘close’s length (int): The short period. Default: 20 scalar (float): A positive float to scale the bands. Default: 2 mamode (str): See `help(ta.ma)`. Default: ‘ema’ offset (int): How many periods to offset the result. Default: 0

Kwargs:
tr (bool): When True, it uses True Range for calculation. When False, use a

high - low as it’s range calculation. Default: True

fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.DataFrame: lower, basis, upper columns.