I'm receiving the below error:
"Error in try.xts(x, error = "chartSeries requires an xtsible object") :
chartSeries requires an xtsible object"
The issue seems to be with chartSeries(as.name(x), if I replace this with MCR.AX, it works as expected. I'm trying to avoid creating repetitive code here.
library(tidyquant)
library(purrr)
# Gather ticker symbols
nickel_stocks <- c("MCR.AX", "CZI.AX", "NIC.AX", "PAN.AX", "POS.AX", "S32.AX",
"SGQ.AX", "WSA.AX")
# Gather xts objects
getSymbols(nickel_stocks)
fun_gen_plts = function(x) {
print(x)
print(as.name(x))
chartSeries(as.name(x),
TA='addVo();
addOBV();
addRSI()',
subset='2019',
theme="white")
}
# Leverage purrr map function to call and pass each stock
# to the chartSEries function
map(nickel_stocks, ~ fun_gen_plts(.x))