I cannot set the current subtitle for the add_TA function (quantmod package).
curon = 2
add_TA(x, type = "l",col = "blue", lwd = 2, on=curon)
(add line to subtitle 2)
R gives me this error:
Error in plot_ta(x = current.chob(), ta = get("x"), on = curon, taType = NULL, :
object 'curon' not found.
team:
add_TA(x, type = "l",col = "blue", lwd = 2, on=2)
working fine though.
NOTE. The problem only occurs when used in a function, and not in a global scope. Here is a complete example:
library(quantmod)
test=function(){
x=xts(runif(10),Sys.Date()+1:10)
z=1/x
chart_Series(x)
add_TA(x, type = "l",col = "green", lwd = 2)
add_TA(z, type = "l",col = "blue", lwd = 2, on=2)
curon = 2;add_TA(z, type = "l",col = "red", lwd = 2, on=curon)
}
test()
source
share