envelope: Moving Average Envelope

Description Usage Arguments Value References Examples

View source: R/technical_indicators.R

Description

This function creates a moving average envelope.

Usage

1
envelope(x, ma = "EMA", n = 22, p = 2.5, ...)

Arguments

x

an xts object that contains OHLC data

ma

Type of moving average used. Default is "EMA". Options are EMA or SMA.

n

Number of periods. Default is 22.

p

percentage of moving the upper and lower bounderies away from the midpoint of the moving average. Default is 2.5. Needs to be between 0 and 100.

...

any other passthrough parameters

Value

Returns a timeseries with the lower and upper bound and the midpoint of the chosen moving average.

References

https://www.investopedia.com/terms/e/envelope.asp

Examples

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

## End(Not run)

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