Description Usage Arguments Details Value See Also Examples
View source: R/protective_stops.R
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.
1 | chandelier(x, n = 22, coef = 3, trend = "up")
|
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". |
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
Returns the chandelier exit points which can be used as stop loss in a trend following strategy.
Other protective stops:
ATR_stop()
,
safezone()
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.