[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GT] Re: Re: Re: Re: Re: Re: EMA incorrect when using --nb-item



You might want to give an alternative value if you are using a very long
EMA, which will then require a very long SMA for the first day. In order
to not loose a lot of data due to the dependencies, one could use, say,
the closing value of the first day as an approximation to EMA (if that
day is long ago there will not be a big difference).

You would use this as follows:

./display_indicator.pl --nb-item=1 I:EMA SPY 20 {I:Prices CLOSE}
{I:Prices CLOSE}
Calculating indicator EMA[20, {I:Prices CLOSE}, {I:Prices CLOSE}] ...
EMA[20, {I:Prices CLOSE}, {I:Prices CLOSE}][2010-07-16] = 106.6600

compare this with

./display_indicator.pl --nb-item=1 I:EMA SPY 20
Calculating indicator EMA[20, {I:Prices CLOSE}] ...
EMA[20, {I:Prices CLOSE}][2010-07-16] = 107.2465

For 1 day, of course, there will be a big difference.

Th.

On 07/23/2010 12:19 AM, Thomas Weigert wrote:
>
> Now say you want to get a 200 day EMA, and you decided that N is 10. To
> get the EMA for the first day you would have to have already 200 days
> before that, and in the case of EMA theoretically infinitely many, as
> the EMA does not really stop. The way GT handles this is that on the
> first day it uses the 200 day SMA (or whatever you give it as the third
> argument, see the documentation).