(for all plot.xts posts, see http://timelyportfolio.blogspot.com/search/label/plot.xts)
As another example of all that we can do with the new plot.xts, let’s try to do a price plot with a moving average overlays. We will use the ETFs shown by Mebane Faber at http://www.mebanefaber.com/timing-model/. With the panel functionality, it is very easy to specify a panel to draw the price line and then add the calculated moving average. Notice how in all the examples, the recession block appears easily and very nicely.
From TimelyPortfolio |
Also, if you wanted to specify some funky layouts, we have that option. For this case, I do not think it makes much sense, but in the future I will demonstrate some more appropriate uses.
From TimelyPortfolio |
Or as one more example, let’s change it up just slightly.
From TimelyPortfolio |
R code in GIST (do raw for copy/paste and also install xtsExtra from r-forge):
No comments:
Post a Comment