LagOHLC: Lag a OHLC Time Series

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/LagFunctions.R

Description

Create a lagged series from OHLC price data

Usage

1
LagOHLC(TS, k=1)

Arguments

TS

xts Time Series containing Open, High, Low and Close Prices

k

periods to lag

Details

shift series k-periods down, prepending NAs to front of series

Value

A xts object containing lagged OHLC columns. The original column names are appended with '.Lag.k', with k being the periods to lag.

The returned series maintains the number of observations of the original.

Note

This function uses the Lag function of the quantmod package.

Author(s)

Andreas Voellenklee

See Also

Lag LagOC

Examples

1
2
3
4
5
6
7
## Not run: 
  getSymbols('YHOO')
  LagOHLC(YHOO)        # Lag OHLC series by one period
  LagOHLC(YHOO, k=1:3) # Lag OHLC series by one, two and three periods
                       # this will return a 12 columns xts object

## End(Not run)

candlesticks documentation built on Feb. 2, 2020, 3:01 a.m.