Question

I want to create a chart using chartSeries with two or more time series on the SAME chart (overlaying each other). Bing/search doc have gotten me nowhere. Seems like should be fairly easy, I tried addTA, but didn't work. I tried the following code.

chartSeries(c(PSEC, ARCC), type = "line")

That resulted into this: (nevermind the fonts, the hell is the green blob?)

enter image description here

Was it helpful?

Solution

The green blob is what you asked R to plot. c(PSEC, ARCC) is the same as rbind(PSEC, ARCC), which creates a single OHLCVA object with two observations per index value (one for PSEC, one for ARCC). You said you tried addTA, but it "didn't work". Saying something "doesn't work" does not help people help you, especially when you don't even show the code that "doesn't work".

Here's a chartSeries call that uses addTA, and a corresponding chart_Series version. Note that chart_Series automatically handles the y-axis range for you.

> chartSeries(Cl(PSEC), TA="addTA(Cl(ARCC), on=1)")
> chart_Series(Cl(PSEC), TA="add_TA(Cl(ARCC), on=1)")

OTHER TIPS

Your data, if it is not daily, could easily look like a green blob.

For example, if that's minute-by-minute prices, I'd expect it to look like this upon visual inspection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top