ATR {avfintools}R Documentation

Average True Range

Description

Returns the average true range as well as the relative price based on the ATR as a reference

Usage

ATR(df, period, current = FALSE, mrprice = NULL, hideprints = TRUE)

Arguments

df

Dataframe with price data.

period

Calculation period in day for the true range

current

If one wants to input the latest price point before data update

mrprice

Most recent price;

hideprints

if TRUE hides the print outs regarding the percentile within an ATR

Value

Returns a vector of ATR calculations in dataframe format. If current = TRUE, returns the most recent ATR as well as where price is in the context of the ATR

Examples

ATR(SPY15, 14)
ATR(SPY15, 14, current = TRUE, mrprice = tail(SPYdaily$close, 1) + 2)

[Package avfintools version 0.1.0 Index]