chartSeries {quantmod} | R Documentation |
Charting tool to create standard financial charts given a time series like object. Serves as the base function for future technical analysis additions. Possible chart styles include candles, matches (1 pixel candles), bars, and lines. Chart may have white or black background.
chartSeries(x, type = c("auto", "candlesticks", "matchsticks", "bars","line"), show.vol = TRUE, show.grid = TRUE, name = deparse(substitute(x)), time.scale = NULL, technicals = NULL, line.type = "l", bar.type = "ohlc", xlab = "time", ylab = "price", theme = "black", up.col,dn.col,color.vol = TRUE, multi.col = FALSE, ...) barChart(x,name=deparse(substitute(x)),type='bars',...) candleChart(x,name=deparse(substitute(x)),type='candlesticks',...) lineChart(x,name=deparse(substitute(x)),type='line', color.vol=FALSE,...)
x |
an OHLC object - see details |
type |
style of chart to draw |
show.vol |
display volume on chart? |
show.grid |
display price grid lines? |
name |
name of chart |
time.scale |
what is the timescale? automatically deduced |
technicals |
a list of technical indicators and params (yet to be added) |
line.type |
type of line in line chart |
bar.type |
type of barchart - ohlc or hlc |
xlab |
derived time scale |
ylab |
y axis label |
theme |
'white' or 'black' background |
up.col |
up bar/candle color |
dn.col |
down bar/candle color |
color.vol |
color code volume? |
multi.col |
4 color candle pattern |
... |
additional parameters |
Currently displays standard style OHLC charts familiar
in financial applications, or line charts when
not passes OHLC data. Works with objects having explicit
time-series properties, at present limited to quantmod.OHLC
data as returned by getSymbols.yahoo
. In theory any zoo
object conforming to OHLC conventions can be coerced to a
quantmod.OHLC
object, and thus charted.
Line charts are created with close data, or from single column time series.
Future versions will allow for additional charting functions to be called subsequently which will allow for additional information to be display on the chart, such as technical indicators/studies, as well as entry and exit points given a particular trade strategy.
line.type
and bar.type
allow further fine tuning of
chart styles to user tastes, as do the addition of
up.col
and dn.col
arguments.
multi.col
implements a color coding scheme used in some
charting applications, and follows the following rules:
Returns a standard chart plus volume, if available, suitably scaled.
Most details can be fine-tuned within the function, though the code does a reasonable job of scaling and labelling axes for the user.
This is mostly a proof-of-concept function. It is currently being rewritten with S4 style constructs to better facilitate the addition of technical analysis indicators, as well as more dynamic updating for adding additional series and rescaling.
Additional motivation to add outlined candles to allow for scaling and advanced color coding is owed to Josh Ulrich, as are the base functions (from TTR) for the yet to be released technical analysis charting code
Jeffrey A. Ryan
Josh Ulrich - TTR package and multi.col coding
## Not run: getSymbols("YHOO") chartSeries(YHOO) barChart(YHOO) candleChart(YHOO) matchChart(YHOO,theme="white") lineChart(YHOO) ## End(Not run)