Skip to content
Prev 10448 / 15274 Next

adapting quantstrat/demo/luxor code

Before applying to.hourly() and align.time():
[1] "xts" "zoo"
Open   High    Low  Close Volume
2004-10-25 00:00:00 0.7429 0.7446 0.7426 0.7438   1445
2004-10-25 01:00:00 0.7436 0.7447 0.7430 0.7436   1209
2004-10-25 02:00:00 0.7436 0.7444 0.7431 0.7440   1011
2004-10-25 03:00:00 0.7438 0.7448 0.7433 0.7444   1078
2004-10-25 04:00:00 0.7444 0.7449 0.7436 0.7442    838
2004-10-25 05:00:00 0.7443 0.7454 0.7431 0.7444   1126

and after:                    AUDUSD.Open AUDUSD.High AUDUSD.Low AUDUSD.Close
2004-10-25 01:00:00      0.7429      0.7446     0.7426       0.7438
2004-10-25 02:00:00      0.7436      0.7447     0.7430       0.7436
2004-10-25 03:00:00      0.7436      0.7444     0.7431       0.7440
2004-10-25 04:00:00      0.7438      0.7448     0.7433       0.7444
2004-10-25 05:00:00      0.7444      0.7449     0.7436       0.7442
2004-10-25 06:00:00      0.7443      0.7454     0.7431       0.7444

AUDUSD.Volume
2004-10-25 01:00:00          1445
2004-10-25 02:00:00          1209
2004-10-25 03:00:00          1011
2004-10-25 04:00:00          1078
2004-10-25 05:00:00           838
2004-10-25 06:00:00          1126

Length of AUDUSD's the same. So I changed the following line:
col_names = c('Open','High','Low','Close','Volume')

to:
colnames(data.xts) <-
c('AUDUSD.Open','AUDUSD.High','AUDUSD.Low','AUDUSD.Close','AUDUSD.Volume')

and viola, it works now without using to.hourly() and align.time()!

I don't know if this is the correct way though.


Thanks for your help,
On Sun, Jul 1, 2012 at 7:31 PM, OpenTrades <jan at opentrades.nl> wrote: