chandelier: Chandelier Exit

Description Usage Arguments Details Value Examples

View source: R/Stops.R

Description

Calculates the chandelier exits in an up or down trend. The calculated exit points are used as a stop loss in a trend following trading strategy.

Usage

1
chandelier(x, n = 22, coef = 3, trend = "up")

Arguments

x

Object that is coercible to xts or matrix and contains High-Low-Close prices.

n

Number of periods for chandelier period. Default is 22.

coef

ATR coefficient. Default is 3

trend

Indicates if chandelier should be calculated for the up-trend or down-trend. Default is up. Possible values are "up" or "down".

Details

In an up-trend the default formula is: Highest High in last 22 days - 3 * ATR for 22 days

In a down-trend the formula is reversed: Lowest Low in last 22 days + 3 * ATR for 22 days

Value

Returns the chandelier exit points which can be used as stop loss in a trend following strategy.

Examples

1
2
3
4
5
6
## Not run: 
getSymbols("ADM", from = "2018-01-01", to = "2018-07-01")
chartSeries(ADM)
addTA(chandelier(ADM), on = 1)

## End(Not run)

pverspeelt/Quantfunctions documentation built on Jan. 21, 2019, 11:33 p.m.