[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] EMA incorrect when using --nb-item
- To: devel <devel
AT
geniustrader.org>
- Subject: [GT] EMA incorrect when using --nb-item
- From: Nick Fantes Huege <nfhuege
AT
gmail.com>
- Date: Tue, 20 Jul 2010 20:24:24 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=3K7BD+C9TZTK8nQcyrioFt/RuuobP4UBZo55VEVWFHc=; b=QN9wbyBoHurJoryJp5C5EM0x/Y7W2dLVYGyWoiCob4p/SiTsoLXK+Y5W2TsrCWXpjk 9Ko42UWBLtY4ZmabZE/8r1GC+Nc8blhSThGD+VDqY+OnmlzF1RQl8PiXeYTlwKkjBa+u xktscUg5s+S2m5VOvqmS7xh8nGTR9QiiMebeg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Fb4RUw6ztKG/zQKNvlYa3YMNclCHuFuMV3yYuqW/HrdESdjWghkrfrvNSVcUoHx35y cIrIYuoUnXNAujiwUOusTxrHuTSg0p07obbjeaaipVrpZ9zBzXW/Xdk5KynG6eNn4fqf 532XKT41y3OA34sWrL5bXkriCNUNDicVZLz+A=
- In-reply-to: <AANLkTilv7c_WX3EPcS8NmTmTEerHkj3scmmviIghE1T8
AT
mail.gmail.com>
- Message-id: <AANLkTilq_LOB8S1B6d9QqV18WM1OzmwlFQ6Rx4FhF56w@mail.gmail.com> (sfid-20100720_192545_534739_93A458A2)
- Reply-to: devel
AT
geniustrader.org
Hello All,
I don't know if this is intentional, but when calculating EMA (and my
guess is that the same is true for all other indicators that give more
wight to the more recent dates) the values produced are incorrect if
--nb-item is used, or if --start and --end are used.
Example:
./display_indicator.pl --full --nb-item=10 I:EMA YHOO 60
...
...
EMA[60, {I:Prices CLOSE}][2010/07/19] = 15.7129
15.712 is wrong value for YHOO's EMA for that day.
After analyzing EMA.pm, it seems the problem is that it does its
calculations based on the last 10 (or --nb-item) prices.
A simple fix would be to add $first = 1 inside the
calculate_interval() subroutine, thus giving it the full range of
prices to work on.
Nick