Hi,

I'm having some problems using the xts and TTR packages.  After running the code below (contents of TY1.txt are at the end of the email), I have two questions:

1) daily.xts has no timestamps but when I pass it in to RSI(), the return object is timestamped.  why does this occur?
2) why does the object returned from ATR() contain multiple rows with the same date where duplicate date rows contain NA's?

The ultimate goal of this code snippet is to run various indicators, cbind them, and write them to a file for further processing. 

thanks,
Brian

code:
library(quantmod);
library(TTR);

TY1.mat = read.table(paste("TY1.txt", sep = ""), header = T);
TY1.mat[,"date"] = as.Date(TY1.mat[,"date"], format = "%Y/%m/%d");
TY1.mat[,"datetime"] = paste(TY1.mat[,"date"], TY1.mat[,"time"], sep = " ");

TY1.xts = xts(TY1.mat[,"TY1"], as.POSIXct(TY1.mat[,"datetime"]));

daily.xts = to.daily(TY1.xts);

myrsi = RSI(daily.xts[,"TY1.xts.Close"]);
myatr = ATR(daily.xts[,c("TY1.xts.High", "TY1.xts.Low", "TY1.xts.Close")]);

file.data = as.matrix(cbind(my.xts, myrsi, myatr));
write.table(file = "TY1.data", append = F, sep = "\t", file.data);


TY1.txt contains the following data:
date    time    TY1
2009/01/02                      08:00:00                        126.328125
2009/01/02                      12:00:00                        126.765625
2009/01/02                      13:00:00                        124.25
2009/01/05                      08:00:00                        124.5
2009/01/05                      12:00:00                        124.78125
2009/01/05                      13:00:00                        123.625
2009/01/06                      08:00:00                        124.359375
2009/01/06                      12:00:00                        124.90625
2009/01/06                      13:00:00                        123.28125
2009/01/07                      08:00:00                        124.78125
2009/01/07                      12:00:00                        124.875
2009/01/07                      13:00:00                        124.015625
2009/01/08                      08:00:00                        124.328125
2009/01/08                      12:00:00                        125.6875
2009/01/08                      13:00:00                        124.265625
2009/01/09                      08:00:00                        125.203125
2009/01/09                      12:00:00                        126.34375
2009/01/09                      13:00:00                        124.875
2009/01/12                      08:00:00                        125.625
2009/01/12                      12:00:00                        126.359375
2009/01/12                      13:00:00                        125.109375
2009/01/13                      08:00:00                        126.3125
2009/01/13                      12:00:00                        126.359375
2009/01/13                      13:00:00                        125.75
2009/01/14                      08:00:00                        126.28125
2009/01/14                      12:00:00                        127.484375
2009/01/14                      13:00:00                        125.8125
2009/01/15                      08:00:00                        127.125
2009/01/15                      12:00:00                        127.515625
2009/01/15                      13:00:00                        126.71875
2009/01/16                      08:00:00                        126.859375
2009/01/16                      12:00:00                        126.875
2009/01/16                      13:00:00                        125.40625
2009/01/20                      08:00:00                        125.828125
2009/01/20                      12:00:00                        126.421875
2009/01/20                      13:00:00                        124.5
2009/01/21                      08:00:00                        125.96875
2009/01/21                      12:00:00                        125.96875
2009/01/21                      13:00:00                        124.578125
2009/01/22                      08:00:00                        124.734375
2009/01/22                      12:00:00                        125.0625
2009/01/22                      13:00:00                        123.703125
2009/01/23                      08:00:00                        124.25
2009/01/23                      12:00:00                        124.765625
2009/01/23                      13:00:00                        123.328125
2009/01/26                      08:00:00                        123.890625
2009/01/26                      12:00:00                        124.109375
2009/01/26                      13:00:00                        123.171875


      
	[[alternative HTML version deleted]]

