ATR_stop: Average True Range Trailing Stop

Description Usage Arguments Details Value Examples

View source: R/Stops.R

Description

This average true range trailing stop was developed by Sylvain Vervoort.

Usage

1
ATR_stop(x, n = 5, coef = 3.5)

Arguments

x

an xts object that contains OHLC data

n

Number of lookback periods for the ATR Stop. Default is 5

coef

ATR coefficient. Default is 3.5

Details

Based on this question on stackoverflow and this article by Sylvain Vervoort.

Value

Returns an average true range trailing stop which can be used as a stop loss in a trend following system.

Examples

1
2
3
4
5
6
7
## Not run: 
# show ATR stop on chart
getSymbols("ADM", from = "2018-01-01", to = "2018-07-01")
chartSeries(ADM)
addTA(ATR_stop(ADM), on = 1)

## End(Not run)

pverspeelt/Quantfunctions documentation built on Jan. 6, 2019, 4:02 a.m.