[R-SIG-Finance] Converting to weekly timestamps removes years from chart.TimeSeries (and its extensions)

Ilya Kipnis ilya.kipnis at gmail.com
Mon Sep 29 03:40:36 CEST 2014


So something that just irritated me is this:

I'm replicating a strategy that uses weekly rebalancing, but when I go to
plot the equity curve, the years cut off on the x axis, which looks weird.

Here's my code:

require(quantstrat)

#long TLT 60%, leverage 3x to 180%, rebalance weekly, short VIX 40%
getSymbols("^VIX", from="1990-01-01")
getSymbols("TLT", from="1990-01-01")
VIX <- to.weekly(OHLC(VIX), OHLC=TRUE)
TLT <- to.weekly(OHLC(TLT), OHLC=TRUE)
vixRets <- Cl(VIX)/Op(VIX)-1
tltRets <- Cl(TLT)/Op(TLT)-1
both <- merge(vixRets, tltRets, join='inner')
colnames(both) <- c("VIX", "TLT")
portfRets <- -.4*both$VIX+1.8*both$TLT
colnames(portfRets) <- "VIXTLT"
charts.PerformanceSummary(portfRets)

Along with the attached picture.

Any tips on how to get the years back into the x axis would be appreciated.

Thanks.

-Ilya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140928/fb364775/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StructArb.png
Type: image/png
Size: 29654 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20140928/fb364775/attachment.png>


More information about the R-SIG-Finance mailing list