atr#
API documentation for pandas_ta.volatility.atr Python function.
- 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.
- Sources:
- Calculation:
- 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)
- else:
ATR = RMA(tr, length)
- if percent:
ATR *= 100 / close
- Args:
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(ta.ma)`
. Default: ‘rma’ talib (bool): If TA Lib is installed and talib is True, Returns the TA Libversion. Default: True
drift (int): The difference period. Default: 1 offset (int): How many periods to offset the result. Default: 0
- Kwargs:
percent (bool, optional): Return as percentage. Default: False fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method
- Returns:
pd.Series: New feature generated.