R version 2.12.0, 64 bit on Windows.

 

Here is a short script that illustrates the problem:

 

library(tseries)

library(xts)

setwd('C:\\cygwin\\home\\Ted\\New.Task\\NKs-01-08-12\\NKs\\tests')

x = read.table("quotes_h.2.dat", header = FALSE, sep="\t", skip=0)

str(x)

y <- data.frame(as.POSIXlt(paste(x$V2,substr(x$V4,4,8),sep="
"),format='%Y-%m-%d %H:%M'),x$V5)

colnames(y) <- c("tickdate","price")

str(y)

plot(y)

z <- as.irts(y)

str(z)

plot(z)

str(alpha3)

List of 2

$ time : POSIXt[1:98865], format: "2010-06-30 15:47:00" "2010-06-30
15:53:00" "2010-06-30 17:36:00" ...

$ value: num [1:98865, 1:4] 9215 9220 9205 9195 9195 ...

  ..- attr(*, "dimnames")=List of 2

  .. ..$ : NULL

  .. ..$ : chr [1:4] "z.Open" "z.High" "z.Low" "z.Close"

- attr(*, "class")= chr "ts"

- attr(*, "tsp")= num [1:3] 1 2 1

alpha3 <- as.xts(to.minutes3(z,OHLC = TRUE))

plotOHLC(alpha3)

Error in plotOHLC(alpha3) : x is not a open/high/low/close time series

 

The file quotes_h.2.dat contains real time tick data for futures contracts,
so the above manipulation is my attempt to just get a time series with one
column being a date/time and the other being tick price.  I believe I have
to use read.table to make a data frame, and then the manipulations to
combine the date and time fields from that feed, along with the price.

 

My first attempt at using to.minutes3 (and I am interested in the other
'to.period' functions too), is to get a regular time series to which I can
apply rollapply, along with a function in which I use various autoregression
methods, along with forecasting for as long as the 95% confidence intervals
is reasonably close - I want to know how far into the future the forecast
contains useful information.  And then, I want to create a plot in which I
do the autoregression, and then plot the actual and forecast prices (along
with the confidence interval), as a function of time, embed that in a
function, which rollappply works with, so I can have a plot comprised of all
those individual plots (plotting only the comparison of actual and forecast
values).

 

It seems everything works adequately until I try the plotOHLC function
itself, which gives me the error in the subject line.

 

I would ask for two things: 

 

1) what the fix is to get rid of that error plotOHLC gives me

2) some tips on the 'walk-forward' method I am looking at using.

 

Thanks

 

Ted


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to