[R-SIG-Finance] Converting to weekly timestamps removes years from chart.TimeSeries (and its extensions)
Joshua Ulrich
josh.m.ulrich at gmail.com
Mon Sep 29 04:22:16 CEST 2014
I get a very reasonable chart and axis when I run your code in a clean
session. The years aren't simply cut off the x-axis labels, all the
"months" are "Aug" and the grid lines extend beyond the edges of the
plots. I think something is funky with your R session.
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
On Sun, Sep 28, 2014 at 8:40 PM, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
> 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
>
>
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
More information about the R-SIG-Finance
mailing list