[R-SIG-Finance] MACD Histogram

Jeff Ryan jeff.a.ryan at gmail.com
Sun Jan 10 15:45:38 CET 2010


Konrad,

Your error is in how you are calling MACD.  See the examples in ?MACD.
 You need to pass it the Close column if you want it to be what you
are expecting.

macd <- MACD(Cl(arl))
macdHist <- macd$macd - macd$signal
addTA(macdHist,type='h')

HTH,
Jeff

On Sun, Jan 10, 2010 at 5:31 AM, Konrad Hoppe <konradhoppe at hotmail.de> wrote:
> Hi Mailinglist members,
>
>
>
> I’ve got a question concerning the histogram which is plotted in the
> addMACD() method. I expect that this represents the difference between the
> macd and the signal line, but when I implement it by myself, I get a clearly
> other result. Please check the following code snippet. I add the MACD
> histogram via the addMACD() method and in addition a second TA, which
> represents the difference between the signal and the macd.
>
> Could you tell me whether I’m mistaking respectively what is plotted in the
> histogram?
>
>
>
> library(quantmod)
>
>
>
> from.dat <- as.Date("01/01/03", format="%m/%d/%y")
>
> to.dat <- as.Date(Sys.Date(), format="%m/%d/%y")
>
> getSymbols("ARL.DE", src="yahoo", from = from.dat, to = to.dat)
>
> arl <- last(ARL.DE , "100 days")
>
>
>
> chartSeries(arl, theme="white", TA=NULL)
>
> addMACD()
>
> macd <- MACD(arl)
>
> macdHist <- macd$macd - macd$signal
>
> addTA(macdHist, type="h")
>
>
>
>
>
> Thanks in advance.
>
> --
>
> Konrad Hoppe
>
>  <http://www.konrad-hoppe.com/> http://www.konrad-hoppe.com/
>
>
>
>
>        [[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.
> -- Also note that this is not the r-help list where general R questions should go.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list