[R-SIG-Finance] Error:subscript out of bounds: no column name containing "Close
Brian G. Peterson
brian at braverock.com
Sun Oct 9 12:41:10 CEST 2016
On 10/08/2016 10:55 PM, Ramesh wrote:
> I have downloaded the time series of crude oil in to R ( from a local excel
> file(csv/text tab delimited) in C drive)and the data ( OHLC) is being
> displayed in my R.Studio.
> Am able to ascertain the Fibonacci pivot levels ( using a custom program
> that I have developed). But when I use package Quantmod and try to
> calculate the values using MACD,RSI etc,I get an error *subscript out of
> bounds: no column name containing "Close" *
> I googled and found that many R users have asked help for this issue in
> the past.By and large this question looks to be remaining unresolved.
> Can you please help me with a solution?
Please follow the posting guide:
https://www.r-project.org/posting-guide.html
You haven't provided a minimal reproducible example, or nearly enough
data to answer your question with certainty.
For the purposes of my guestimate, we'll assume your variable is called 'x'
I suspect that your 'OHLC' data doesn't contain any columns that
quantmod's OHLC utility functions can recognize as close data.
Check the column names of your data.
Try using quantmod functions such as Cl(x) or is.OHLC(x) to see if
quantmod recognizes your column names. (They are looking for variations
of English words such as 'open, 'high', 'low', and 'close',
capitalization unimportant)
The TTR functions MACD and RSI expect univariate data, not OHLC data, as
is noted in the documentation. You could try something like:
RSI(getPrice(x))
MACD(getPrice(x))
and the quantmod function 'getPrice' will try to guess at a column that
may contain price data. This may suffer from the same problem as above.
In short, your problem is almost certainly that the column names of your
imported data are unintelligible: Check this first.
If you're still having trouble, please follow the posting guide and
provide a minimal reproducible example.
--
Brian
More information about the R-SIG-Finance
mailing list