Skip to main content

atr

Calculate the Average True Range.

Used to measure volatility, especially volatility caused by gaps or limit moves. The ATR metric helps understand how much the values in your data change on average, giving insights into the stability or unpredictability during a certain period. It's particularly useful for spotting trends of increase or decrease in variations, without getting into technical trading details. The method considers not just the day-to-day changes but also accounts for any sudden jumps or drops, ensuring you get a comprehensive view of movement.

Example​

from openbb import obb

stock_data = obb.equity.price.historical(symbol='TSLA', start_date='2023-01-01', provider='fmp')
atr_data = obb.technical.atr(data=stock_data.results)

Parameters​

NameTypeDescriptionDefaultOptional
dataList[Data]List of data to apply the indicator to.False
indexstrIndex column name, by default "date"dateFalse
lengthintIt's period, by default 1414False
mamodeLiteral['rma', 'ema', 'sma', 'wma']Moving average mode, by default "rma"rmaFalse
driftintThe difference period, by default 11False
offsetintHow many periods to offset the result, by default 00False

Returns​

OBBject
results : List[Data]
List of data with the indicator applied.