[R-SIG-Finance] quantmod EMA and SMA

Joshua Ulrich josh.m.ulrich at gmail.com
Sat Mar 14 17:22:12 CET 2015


On Mon, Mar 9, 2015 at 9:04 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
> On Mon, Mar 9, 2015 at 8:14 AM, Olivier MARTIN
> <Olivier.Martin at avignon.inra.fr> wrote:
>> Hi all,
>>
>> I compare the serie from the function EMA() and the one from addEMA()
>>
>>   getSymbols("^FCHI")
>> M7=EMA(Cl(FCHI),7)
>> candleChart(FCHI,theme="white",subset="2015",TA=NULL)
>> addEMA(7)
>> addTA(M7,on=-1)
>>
>> I don't understant why I don't obtain the same serie with the two
>> functions...
>
> M7 is calculated using the close price.  You didn't specify which
> column to use in the addEMA call, so it used the first column--the
> open.
>
It looks like this is a long-standing bug.  The current behavior
originated in 2008, so I checked with Jeff.  He confirmed that the
intention was to choose the Close if the data were OHLC and with.col
was not specified.

I have filed and fixed the issue.
https://github.com/joshuaulrich/quantmod/issues/41

Thanks for the report!

>> Reagrds,
>> Olivier.
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org 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.
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list