I just got introduced to quantmod, and looked at examples here http://www.r-chart.com/2010/06/stock-analysis-using-r.html I tried the following code,
getSymbols(c("^GSPC","^VIX"))
head(as.xts(merge(GSPC,VIX)))
chartSeries(c(GSPC, VIX), subset='last 3 months')
but the graph was completely out-of-scale, so I hope some of the experts on this forum can show me how to plot this correctly.
Try this:
chart_Series(GSPC)
add_Series(OHLC(VIX)+1000,on=1)
You need to use OHLC to remove the volume from VIX, since it's always zero and seems to hose up the automatic ylim calculation. I also added 1000 to make the levels of the two series to be a bit closer together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With