plotOHLC               package:tseries               R Documentation

_P_l_o_t _O_p_e_n-_H_i_g_h-_L_o_w-_C_l_o_s_e _B_a_r _C_h_a_r_t

_D_e_s_c_r_i_p_t_i_o_n:

     Plots open-high-low-close bar chart of a (financial) time series.

_U_s_a_g_e:

     plotOHLC(x, xlim = NULL, ylim = NULL, xlab = "Time", ylab, col = par("col"),
              bg = par("bg"), axes = TRUE, frame.plot = axes, ann = par("ann"),
              main = NULL, date = c("calendar", "julian"), format = "%Y-%m-%d", ...)

_A_r_g_u_m_e_n_t_s:

       x: a multivariate time series object of class `"mts"'.

xlim, ylim, xlab, ylab, col, bg, axes, frame.plot, ann,
main: graphical
          arguments, see `plot', `plot.default' and `par'.

    date: a string indicating the type of x axis annotation. Default is
          calendar dates.

  format: a string indicating the format of the x axis annotation if
          `date == "calendar"'. For details see `format.POSIXct'.

     ...: further graphical arguments passed to `plot.window', `title',
          `axis', and `box'.

_D_e_t_a_i_l_s:

     Within an open-high-low-close bar chart, each bar represents price
     information for the time interval between the open and the close
     price. The left tick for each bar indicates the open price for the
     time interval. The right tick indicates the closing price for the
     time interval. The vertical length of the bar represents the price
     range for the time interval.

_A_u_t_h_o_r(_s):

     A. Trapletti

_S_e_e _A_l_s_o:

     `plot.default', `format.POSIXct', `get.hist.quote'

_E_x_a_m_p_l_e_s:

     # Plot OHLC bar chart for the last `nDays' days of the instrument `instrument'

     nDays <- 50
     instrument <- "^spc"

     start <- strftime(as.POSIXlt(Sys.time() - nDays*24*3600), format="%Y-%m-%d") 
     end <- strftime(as.POSIXlt(Sys.time()), format = "%Y-%m-%d") 
     x <- get.hist.quote(instrument = instrument, start = start, end = end)

     plotOHLC(x, ylab = "price", main = instrument)

