[R] Quantmod Error Message

Tyler Campbell tyler.campbell at tradeforecaster.com
Mon Jul 12 17:29:24 CEST 2010


I am trying to create a model using the Quantmod package in R. I am
using the following string of commands:
> ema<-read.csv(file="ESU0 Jul 7 1 sec data.csv")
> Bid=(ema$Bid)
> twentysell=EMA(Bid,n=1200)
> fortysell=EMA(Bid,n=2400)
> sigup<-ifelse(twentysell>fortysell,1,0)
> sigdn<-ifelse(twentysell<fortysell,-1,0)
> specifyModel(Next(sigup)~lag(sigup,1) + Next(sigdn)~lag(sigdn,1), 1:31624)

After this last command, I get this error message:
Error in as.Date.default(x, origin = "1970-01-01") :
  do not know how to convert 'x' to class "Date"

I've thought it was a time series issue, but I have tried converting
the "sigup" and "sigdn" to a time series using
>sigup_ts=ts(sigup)
>sigdn_ts=ts(sigdn)
But the error still comes up. Any help on this issue would be greatly
appreciated.

Thanks,
Tyler Campbell
tyler.campbell at tradeforecaster.com



More information about the R-help mailing list