Skip to content

Commit

Permalink
Add TA functionality to chartSeries
Browse files Browse the repository at this point in the history
Add TA functionality to handle "addVo()" argument. If Volume is not
included in x, "addVo()" will be removed from TA.

Allow TA=NULL to work.
  • Loading branch information
erichung0404 committed Aug 7, 2016
1 parent 5160aea commit b62b868
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions R/chartSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,20 @@ function(x,
y.intersp=0.95))
cs$set_frame(2)
cs$add(text.exp, env=cs$Env, expr=TRUE)

# handle TA="addVo()" as we would interactively FIXME: allow TA=NULL to work
if(!show.vol) TA <- TA[-grep("addVo()", TA)]
if(!is.null(TA) && length(TA) > 0) {
TA <- parse(text=TA, srcfile=NULL)
for(ta in seq_along(TA)) {
if(length(TA[ta][[1]][-1]) > 0) {
cs <- eval(TA[ta])
} else {
cs <- eval(TA[ta])
}
}
}
assign(".xts_chob", cs, xts:::.plotxtsEnv)
if(plot) # draw the chart
cs
} #}}}

0 comments on commit b62b868

Please sign in to comment.