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

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



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