rtsplot.polygon: Add polygon to time series plot

rtsplot.polygonR Documentation

Add polygon to time series plot

Description

Add polygon to time series plot

Usage

rtsplot.polygon(y, col = graphics::par("col"), ...)

Arguments

y

xts object with 2 columns

col

color, defaults to par('col')

...

additional parameters to the lines

Value

nothing

Examples

y = rtsplot.fake.stock.data(1000, ohlc=TRUE) 
symbol = 'SPY'
	
 # moving average
bbands = TTR::BBands(quantmod::HLC(y), n=200, sd=1)[,c('up','dn')]	

 # plot
 layout(1)
 rtsplot(y, type = 'l', col='black')
 col = grDevices::adjustcolor('green', 50/255)
 rtsplot.polygon(bbands, col = col)
rtsplot.legend(c(symbol, 'BBands'), c('black', col), list(y,bbands))


rtsplot documentation built on Sept. 24, 2023, 1:07 a.m.