I got a few examples from TTR documentation like:
data(ttrc)
mfi <- MFI(ttrc[,c("High","Low","Close")], ttrc[,"Volume"])
data(ttrc)
price <- ttrc[,"Close"]
data(ttrc)
macd <- MACD( ttrc[,"Close"], 12, 26, 9, maType="EMA" )
data(ttrc)
ema.20 <- EMA(ttrc[,"Close"], 20)
Is data(ttrc)
a data-dummy or what?
I want to use
getSymbols("AAPL",src="yahoo")
for the Series and select the right column from it like 'close' or 'volume'
"series that is coercible to xts or matrix"
How do I transform the timeseries from getSymbols
to right matrix to use the examples from the documentation?
Thanks!
The manual, ?ttrc
, confirms that the data is random.
You can extract the columns you want with the Ad
, Vo
, etc. functions or directly with square brackets.
tail( MACD(Ad(AAPL)) )
tail( MACD( AAPL[,"AAPL.Adjusted"] ) )