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

RE: [GT] Problem with display_indicator/EMA/revision 599



Joao,

here is my results, and now I understand better your concern:

1. in the first experiment, we return 2 years of data, not sure why the scripts would have returned 200 data items before. The documentation said 2 years. The code for this is:
    $first = $last - 2 * GT::DateTime::timeframe_ratio($YEAR, 
                             $calc->current_timeframe);

2. Yes, you should see no data, as the I:EMA cannot be computed from the first day on.

So (1) is as designed, and (2) also, but I believe it is not how it should be. As you remembered below, I argued for that we should change calculate_indicator to try to find a period within the selected periods from which on it can return data.

Robert argued against adding that, as it would require a change to all indicators that use calculate_indicator and have an algorithm that relies on every piece of data.

Until this is decided how to handle, you can just comment out calculate_interval, and you will get all data (albeit somewhat slower).

Th.



João Costa wrote: 

	Thanks.
	
	I'm now using the same data as you, I get different behaviour with the
	Text db module, but the underlying problems are still there.
	


________________________________

From: João Costa [mailto:joaocosta
AT
zonalivre.org]
Sent: Fri 7/25/2008 6:41 AM
To: devel
AT
geniustrader.org
Subject: Re: [GT] Problem with display_indicator/EMA/revision 599



I've checked my db query and it is returning the data as expected,
using a different symbol won't make any difference.

>From what i've debugged so far there are two different issues here:

1 - The change in revision 599 makes the scripts return all the
available data, where before they would only return 200 items. This
makes the --full flag redundant but i can live with that for now.

2 - The calculate_interval method in EMA fails to return any values if
it can't calculate the first value.


Because the scripts ask for the entire history, and since an EMA
cannot be calculated for the first period of the entire history, it
simply fails to return anything at all.

I remember you and Robert discussing issue #2 on the list some time
ago. I've read those messages this week.  You had mentioned some fix
which involved changing the implementation of calculate_interval in
the Indicators, and that seemed fine to me.  If you have that fix I
think now would be a good time to apply it.