我希望仅更改chart_Series中add_MACD图表中MACD线或信号线的颜色。
我的示例代码是:
getSymbols("GSPC")
myChart_Theme <- chart_theme()
chart_Series(GSPC,
subset = "2017/",
type = "candlesticks",
theme = myChart_Theme,
TA = 'add_MACD(histogram = FALSE)'
)
我都尝试过:
myChart_Theme <- chart_ theme
myChart_Theme$macd$macd <- "blue"
以及
TA = 'add_MACD(histogram = FALSE, col = c("blue","blue","blue","blue"))'
但是似乎都不起作用,并且两条线始终都是黑色的。
有人可以建议如何开始工作吗?谢谢
这将起作用:
getSymbols("SPY")
cs <- chart_Series(SPY, subset="2019/", type="candlesticks", TA='add_MACD(histogram=FALSE)')
cs$Env$theme$macd$macd = 'blue';
plot(cs)