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

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



No,

RAS is correct.

--nb_item is used to determine how many data items to consider.
--nb-item, --full, --start, and --end cooperate in determining what
precise period is being considered. This is clearly documented in the
pod of each of the scripts. Last record is special for
display_indicator, as sometimes one wants to retrieve the value of just
the last item.

Regarding your question of the 200 items, gt will load additional data
to satisfies dependencies, should such be available.

Please note that there is a difference between loading data and
considering data during the computation. For example, when using text as
your data source, the full series is always loaded. You can only limit
the data being loaded when you use a data base. There is a different
flag for that; this is not controlled by above.

th.



On 07/21/2010 10:29 PM, Nick Fantes Huege wrote:
> Hello Ras,
>
> Thank you for your answer! Allow me to respectfully disagree with you
> about the use of --nb-items. It seems that its purpose was to limit
> the number of results displayed, not computed.
>
> In Scripts/display_indicator.pl we see the following code:
>
> if ($last_record) {
>     $full    = 0;
>     $start   = '';
>     $end     = '';
>     $nb_item = 1;
> }
>
> $last_record is set if we pass the option --last-record.
>
> In other words, if we want to see only the last record (for example
> the EMA for today) we add --last-record, which sets $nb_item to 1.
>
> The above code contradicts with the code in Tools::find_calculator
> where $nb_item clearly trumps $full, but yields to $start and $end,
> and so participates in the computing of the indicator. To my opinion
> this should be fixed, and I don't mind doing it if we agree to it.
>
> If I'd like to see today's EMA(200) for YHOO, I could use this:
> ./display_indicator.pl --last-record I:EMA YHOO 200
> completely equal to:
> ./display_indicator.pl --nb-item=1 I:EMA YHOO 200
>
> How is a 200 day moving average going to get computed if we only have
> one day available?
>
> You ask:
>   
>> i'm not sure why you would want to use --nb-item=10 and also use a 60
>> bar time period ema?
>>     
> The example was supposed to display the last 10 values of a 60 day
> EMA, the same way this chart does:
> http://stockcharts.com/h-sc/ui?s=YHOO&p=D&yr=0&mn=0&dy=10&id=p58199359097
>
> I still think that &calculate_interval in EMA.pm must be fixed to set
> --full=1 (or $first = 0) in order to present as accurate moving
> average value as possible. Otherwise any signals that use --nb-item
> are going to be misleading.
>
> Regards,
> Nick
>
>