Description Usage Arguments Details Value Examples
A wrapper for function chart_Series()
from package
quantmod.
1 |
|
An xts time series or an OHLC time series. |
|
A vector of strings with the custom line colors. |
|
A numeric vector with two elements containing the y-axis range. |
|
A Boolean vector or xts time series for specifying the shading areas, with TRUE indicating "lightgreen" shading, and FALSE indicating "antiquewhite" shading. |
|
A Boolean argument: if |
|
Additional arguments to function |
The function chart_xts()
plots a line plot of a xts
time series, or a candlestick plot if x_ts is a OHLC time
series. The function chart_xts()
plots with custom line colors and
vertical background shading, using the function chart_Series()
from
package
quantmod.
By default chart_xts()
opens and plots in an x11 window.
The function chart_xts()
extracts the chart_Series()
chart
object and modifies its ylim parameter using accessor and setter
functions. It also adds background shading specified by the in_dic
argument, using function add_TA()
. The in_dic
argument should
have the same length as the x_ts
time series. Finally the function
chart_xts()
plots the chart object and returns it invisibly.
A chart_Series()
object returned invisibly.
1 2 3 4 5 6 7 | # Plot candlestick chart with shading
rutils::chart_xts(rutils::etf_env$VTI["2015-11"],
name="VTI in Nov 2015", ylim=c(102, 108),
in_dic=zoo::index(rutils::etf_env$VTI["2015-11"]) > as.Date("2015-11-18"))
# Plot two time series with custom line colors
rutils::chart_xts(na.omit(cbind(rutils::etf_env$XLU[, 4],
rutils::etf_env$XLP[, 4])), col_ors=c("blue", "green"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.