This is an extended question.
I use my own layout for the quantmod chartSeries function, and I can even create my own newTA. Everything is working fine. But...
What I want to do, but I can’t:
a) Manipulate the legend about each of the three diagrams: - go to another corner (from "topleft" to "topright") - change the content - delete it completely if necessary ...
b) My indicator generates 2 legends: value1 value2 is the same as above ... how can I change them? how can i delete them?
c) control position and yaxis range (put it left / right or even delete them the same when there is a time axis on the graph
d) Change the main legend (one in the upper right corner where the date range is written
Working code example:
library(quantmod)
getSymbols("SPY", src="yahoo", from = "2010-01-01")
value1 <- rnorm(30, mean = 50, sd = 25)
value2 <- rnorm(30, mean = 50, sd = 25)
dataset <- merge(first(SPY, n = 30),
value1,
value2)
myTAfun <- function(a){
a[,7:8]
}
newMyTA <- newTA(FUN = myTAfun,
lty = c("solid", "dotted"),
legend.name = "My_TA",
col = c("red", "blue")
)
layout(matrix(c(1, 2, 3), 3, 1),
heights = c(2.5, 1, 1.5)
)
chartSeries(dataset,
type = "candlesticks",
main = "",
show.grid = FALSE,
name = "My_Indicator_Name",
layout = NULL,
up.col = "blue",
dn.col = "red",
TA = c(newMyTA(),
addVo()
),
plot = TRUE,
theme = chartTheme("wsj")
)
I tried using the legend command as well as the legend.name option (with very limited output control). I looked at the chob object returned by chartSeries, but I cannot figure out what to do next ...
Image below:
