atr(high, low, close, length=None, mamode=None, talib=None, drift=None, offset=None, **kwargs)[source]#

Average True Range (ATR)

Averge True Range is used to measure volatility, especially volatility caused by gaps or limit moves.


Default Inputs:

length=14, drift=1, percent=False

EMA = Exponential Moving Average SMA = Simple Moving Average WMA = Weighted Moving Average RMA = WildeR’s Moving Average TR = True Range

tr = TR(high, low, close, drift) if ‘ema’:

ATR = EMA(tr, length)

elif ‘sma’:

ATR = SMA(tr, length)

elif ‘wma’:

ATR = WMA(tr, length)


ATR = RMA(tr, length)

if percent:

ATR *= 100 / close


high (pd.Series): Series of ‘high’s low (pd.Series): Series of ‘low’s close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 14 mamode (str): See `help(`. Default: ‘rma’ talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib

version. Default: True

drift (int): The difference period. Default: 1 offset (int): How many periods to offset the result. Default: 0


percent (bool, optional): Return as percentage. Default: False fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method


pd.Series: New feature generated.