1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/priceBands.R 3\name{PBands} 4\alias{PBands} 5\alias{priceBands} 6\title{Construct (optionally further smoothed and centered ) volatility bands around 7prices} 8\usage{ 9PBands( 10 prices, 11 n = 20, 12 maType = "SMA", 13 sd = 2, 14 ..., 15 fastn = 2, 16 centered = FALSE, 17 lavg = FALSE 18) 19} 20\arguments{ 21\item{prices}{A univariate series of prices.} 22 23\item{n}{Number of periods to average over.} 24 25\item{maType}{A function or a string naming the function to be called.} 26 27\item{sd}{The number of standard deviations to use.} 28 29\item{\dots}{any other pass-thru parameters, usually for function named by 30\code{maType}.} 31 32\item{fastn}{Number of periods to use for smoothing higher-frequency 'noise'.} 33 34\item{centered}{Whether to center the bands around a series adjusted for high 35frequency noise, default \code{FALSE}.} 36 37\item{lavg}{Whether to use a longer \code{(n*2)} smoothing period for 38centering, default \code{FALSE}.} 39} 40\value{ 41A object of the same class as \code{prices} or a matrix (if 42\code{try.xts} fails) containing the columns: 43\describe{ 44 \item{ dn }{ The lower price volatility Band. } 45 \item{ center }{ The smoothed centerline (see details). } 46 \item{ up }{ The upper price volatility Band. } 47} 48} 49\description{ 50John Bollinger's famous adaptive volatility bands most often use the typical 51price of an HLC series, or may be calculated on a univariate price series 52(see \code{\link{BBands}}). 53} 54\details{ 55This function applies a second moving average denoted by \code{fastn} to 56filter out higher-frequency noise, making the bands somewhat more stable to 57temporary fluctuations and spikes. 58 59If \code{centered} is \code{TRUE}, the function also further smoothes and 60centers the bands around a centerline adjusted to remove this higher 61frequency noise. If \code{lavg} is also \code{TRUE}, the smoothing applied 62for the middle band (but not the volatility bands) is doubled to further 63smooth the price-response function. 64 65If you have multiple different price series in \code{prices}, and want to use 66this function, call this functions using \code{lapply(prices,PBands,...)}. 67} 68\examples{ 69 70 data(ttrc) 71 pbands.close <- PBands( ttrc[,"Close"] ) 72 73} 74\seealso{ 75\code{\link{BBands}} 76} 77\author{ 78Brian G. Peterson 79} 80\keyword{ts} 81