Open jsramseyer opened 4 years ago
You may get the desired result with the newer charting functions. Try this:
d <- na.omit(getSymbols("VALE3.SA", from=Sys.Date()-300, to=Sys.Date(), auto.assign=FALSE))
rm(g) # remove graphics chob in case it exists already
g <- chart_Series(d, TA='add_EMA(n=21, on=1); add_Vo()', name='vale3.sa')
g <- add_TA(SMA(Vo(d), n=20), col='blue', on=2)
plot(g)
I agree that this is a bug in chartSeries()
and/or addTA()
, but I'm not sure it's worth the effort to try and fix. Especially when chart_Series()
works.
Description
Chartseries adds (by default) a second volume chart, equivalent to "addVo ()"
The volume chart scale is represented in a friendly way (x thousand, x one hundred thousand, etc.)
When we add the Volume average to this graph, it is plotted without friendly scaling (x unit) and is outside the plot area.
Expected behavior
he expected behavior is to represent "SMA (Vo (VALE3.SA), n = 20)" on the same scale as the variable that created the second graph, in this case "Vo ()".
Minimal, reproducible example
Session Info