This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(RCurl)
## Warning: package 'RCurl' was built under R version 3.1.2
## Loading required package: bitops
## Warning: package 'bitops' was built under R version 3.1.2
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "Rcurl")))

#credentials$handshake()
date()
## [1] "Fri Jan 16 22:50:46 2015"
library(quantmod)
## Warning: package 'quantmod' was built under R version 3.1.2
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Loading required package: TTR
## Version 0.4-0 included new data defaults. See ?getSymbols.
portfolio = c("GOOG","BIDU","TCEHY","SINA")
d<-Sys.Date()-365
getSymbols(portfolio, src="yahoo", from=d)
##     As of 0.4-0, 'getSymbols' uses env=parent.frame() and
##  auto.assign=TRUE by default.
## 
##  This  behavior  will be  phased out in 0.5-0  when the call  will
##  default to use auto.assign=FALSE. getOption("getSymbols.env") and 
##  getOptions("getSymbols.auto.assign") are now checked for alternate defaults
## 
##  This message is shown once per session and may be disabled by setting 
##  options("getSymbols.warning4.0"=FALSE). See ?getSymbol for more details
## [1] "GOOG"  "BIDU"  "TCEHY" "SINA"

You can also embed plots, for example:

op<-par(mfrow=c(2,2))
chartSeries(GOOG,TA=NULL,layout=NULL)
chartSeries(BIDU,TA=NULL,layout=NULL)
chartSeries(TCEHY,TA=NULL,layout=NULL)
chartSeries(SINA,TA=NULL,layout=NULL)

par(op)
#op<-par(mfrow=c(2,2))
chartSeries(GOOG,theme="white",TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")

#par(op)
chartSeries(BIDU,theme="white",TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")

chartSeries(TCEHY,theme="white",TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")

chartSeries(SINA,theme="white",TA="addVo();addBBands();addCCI();addDEMA();addZLEMA()")

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.