[R-SIG-Finance] Buy and sell signal with quantmod?

Jeff Ryan jeff.a.ryan at gmail.com
Thu Oct 9 22:29:27 CEST 2008


Michael,

Take a look at addPoints.

Try:

library(quantmod)
library(TTR)

getSymbols("QQQQ")
barChart(QQQQ,TA=NULL)

peak <- function(x) {
 which(diff(sign(diff(x))) < 0) + 2
}

addPoints(peak(MACD(Cl(QQQQ))[,1]),pch=25,col='red',offset=1.03)

This may or not work as advertised in the current CRAN version, but
will if you build yourself from the source on R-forge.

For the record, this is a very under-developed part of the current
release (and even current devel).  I should be releasing updates to
both quantmod and xts in the next few weeks which make some bigger
improvements.  Very big changes to xts especially.

On tap for the newest version of quantmod will be more base graphical
functionality incorporated into the add*** style framework, as well as
a few new general improvements, and of course bug fixes.  I hope to
find the time to update the quantmod.com as well.

Thanks,
Jeff

On Thu, Oct 9, 2008 at 12:14 PM, Michael Zak <michael at zak.li> wrote:
> HI there,
>
> I'm using quantmod to display my finance data with chartSeries(). I already
> calculated the buy and sell indicators in the R code, but it would be nice
> if I could display a sell and buy symbol (like an arrowhead or a bigger dot
> with different colors) in the chart. Is this possible to do that with
> quantmod or is there a better solution for my problem?
>
> My actual project is to port the whole trading system from TradersStudio to
> R, so I can optimize the algorithmus behind. And TradersStudio shows you the
> indicators where you should buy and sell...
>
> I'm sorry for all the newbie questions, but I'm still a student ;)
>
> Thank you, Michael
>
> _______________________________________________
> 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.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list