chandelier: Chandelier Exit

Description Usage Arguments Details Value See Also Examples

View source: R/protective_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.

See Also

Other protective stops: ATR_stop(), safezone()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
libary(quantmod)
ADM <- getSymbols("ADM", 
                  from = "2018-01-01", 
                  to = "2018-07-01",
                  auto.assign = FALSE)
chartSeries(ADM)
addTA(chandelier(ADM), on = 1)

## End(Not run)

pverspeelt/Quantfunctions documentation built on Oct. 10, 2021, 1:01 p.m.