rtsplot.polygon {rtsplot}R 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))


[Package rtsplot version 0.1.5 Index]