[R-SIG-Finance] Align 5 minute bars

Noah Silverman noahsilverman at ucla.edu
Thu Jun 16 21:25:14 CEST 2011


And another question...

When I use the xts function to.minutes5(), I get a nice OHLC summary, BUT the time stamps are "messy".  Since my first and/or last ticks are not exactly on the minute, every 5 minute bar is now on some mid-minute frequency. 

Example:

to.minutes5(ds, indexAt="endof")
                    ds.Open ds.High ds.Low ds.Close ds.Volume
2007-01-01 18:34:44  882.50  883.75 880.50   880.50        83
2007-01-01 18:39:46  880.75  881.00 880.00   880.50        18
2007-01-01 18:44:52  880.25  880.25 879.50   880.00        25
2007-01-01 18:49:03  880.25  881.75 880.25   881.50        83
2007-01-01 18:52:11  881.50  881.50 881.50   881.50         9



Ideally, I'd love to have my bars aligned with round minute numbers.  i.e.
18:30
18:35
18:40
etc...

Any suggestions?

--
Noah Silverman
UCLA Department of Statistics
8117 Math Sciences Building
Los Angeles, CA 90095



More information about the R-SIG-Finance mailing list