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

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



Thomas,

Thank you for your reply!
I am beginning to think that we are looking at different versions of GT.

> --max-loaded-items is an optimization to avoid loading records from the
> data base that are not needed for analysis. It has no impact on analysis
> other than these records will not be available. Note that you have to be
> careful in using it, as the analysis might need more data than one
> thinks, due to dependencies of indicators, for example. It has no effect
> for text data.

It seems that for the dependencies of indicators GT automatically
changes max-loaded-items to -1, ignoring the user defined value. This
way it grabs all of the available data. Note that I'm testing with
DB::module=genericdbi, using SQLite.

> When you use these parameters in a script, they apply to the base
> market. They do NOT dictate how much other data is considered. For
> example, a 200 day indicator will load much more data, even if you say
> you just want the last 10 days of analysis.

I disagree. The following line:
./display_indicator.pl --nb-item=1 I:EMA YHOO 200
considers in its calculations only one data item. I tested, retested
and finally traced it with the Perl debugger. It bases all
calculations on the last day price of YHOO.
I still think that at the very least this should print a warning.

> Regarding EMA, you have to be careful. Technically, EMA needs data from
> the first day of the market, as it goes back indefinitely. Most
> implementations of EMA limit the data and just use SMA for the first
> data point that they are looking at. You can control this in gt by
> giving a third parameter to EMA.

Can you give me an example of using the third parameter?

>> Both commands are absolutely equal because --last-record is a
>> synonymous for --nb-item=1
>
> This is correct. --last-record is just a shortcut to get the last data
> item only. It does NOT mean that we only compute the EMA based on 1 day.

It DOES mean that we compute EMA based on only 1 day.
Here is what --last-record does:
if ($last_record) {
    $full    = 0;
    $start   = '';
    $end     = '';
    $nb_item = 1;
}

Best regards,
Nick