[R-SIG-Finance] Trouble using ohlcPlot

Michael Zak zakdump at gmail.com
Tue Jan 6 13:37:57 CET 2009


Hi

You should use colnames() if they're columns instead of names(). Try  
this:

mts <- cbind(results$OpenPrice, results$HighPrice, results$LowPrice,  
results$ClosePrice)
colnames(mts) <- c("Open",  "High",  "Low", "Close")
ohlcPlot(mts)

HTH, Michael Zak

On 06.01.2009, at 12:27, Neil Beddoe wrote:

> Hi,
>
> Sorry about the cross-posting with r-help, I've just found this list.
>
> I'm trying to create a time series that will work with ohlcPlot:
>
> mts<-ts(data=c(results$OpenPrice,results$HighPrice,results$LowPrice,  
> results$ClosePrice),c="mts",names=c("Open", "High", "Low","Close"))
>
> ohlcPlot(mts) fails with: Error in if ((!is.mts(x)) || (colnames(x) 
> [1] != "Open") || (colnames(x)[2] !=  : ...
>
> is.mts(mts) returns true but colnames(mts) returns NULL.
>
> I've trawled the archive for an example of using this function to no  
> avail and it's not apparent from the docs what the data needs to  
> look like.  Does anyone have an example of code that will work with  
> this function?
>
> Thanks
>
> Neil
>
>
> .
>
> This message is intended only for the use of the person(s) to whom  
> it is addressed. It may contain information which is privileged and  
> confidential. Accordingly any unauthorised use is strictly  
> prohibited. If you are not the intended recipient, please contact  
> the sender as soon as possible.
>
> It is not intended as an offer or solicitation for the purchase or  
> sale of any financial instrument or as an official confirmation of  
> any transaction, unless specifically agreed otherwise. All market  
> prices, data and other information are not warranted as to  
> completeness or accuracy and are subject to change without notice.  
> Any opinions or advice contained in this Internet email are subject  
> to the terms and conditions expressed in any applicable governing  
> Marble Bar Asset Management LLP's  terms and conditions of business  
> or client agreement letter. Any comments or statements made herein  
> do not necessarily reflect those of Marble Bar Asset Management LLP.
>
> Marble Bar Asset Management LLP is regulated and authorised by the  
> FSA.
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.



More information about the R-SIG-Finance mailing list