BBands. This function applies a second moving average denoted by fastn to
filter out higher-frequency noise, making the bands somewhat more stable to
temporary fluctuations and spikes.
PBands(prices, n=20, maType="SMA", sd=2, ..., fastn=2,
centered=FALSE, lavg=FALSE)maType.FALSE.(n*2) smoothing period for
centering, default FALSE.prices or a matrix (if try.xts
fails) containing the columns:centered is TRUE, the function also further smoothes and
centers the bands around a centerline adjusted to remove this higher
frequency noise.
If lavg is also TRUE, the smoothing applied for the middle band
(but not the volatility bands) is doubled to further smooth the price-response
function. If you have multiple different price series in prices, and want to use
this function, call this functions using lapply(prices,PBands).
BBandsdata(ttrc)
pbands.close <- PBands( ttrc[,"Close"] )Run the code above in your browser using DataLab