The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finance::GeniusTrader::Indicators::Generic::ByName - Alias to another indicator

DESCRIPTION

Sometimes, during the computation of an indicator, one needs to reference the current value of a series that is being computed by this indicator. If the current indicator is used explicity, an infinite recursion arises due to the dependency mechanism.

This indicator resolves the recursion. This indicator is nothing more than an alias of a series calculated by an indicator. Just give as first parameter the name of the value to use.

This indicator is used when, during the calculation of an indicator, an intermediate series wants to leverage another intermediate series or an output value.

For example,

    $self->{'sma1'} = Finance::GeniusTrader::Indicators::SMA->new([ 
                      $self->{'args'}->get_arg_names(1),
                      $self->{'args'}->get_arg_names(2) ]);
    $self->{'sma2'} = Finance::GeniusTrader::Indicators::SMA->new([ 
                      $self->{'args'}->get_arg_names(1),
                      "{I:Generic:ByName "
                    . $self->{'sma1'}->get_name . "}" ]);

The first statement defines an intermediate series which smoothes the second parameter. The second statement takes that series and applies smoothing again. Similarly, the following applies smoothing to the first output value.

    $self->{'sma3'} = Finance::GeniusTrader::Indicators::SMA->new([
                      $self->{'args'}->get_arg_names(1),
                      "{I:Generic:ByName " . $self->get_name(0) . "}" ]);

Care has to be taken that I:Generic:ByName is in fact given the name of an indicator, lest that series will not be found. Note that if the series is an indicator, the name of the series is the name of the selected return value. The get_name method will always retrieve the name of a series.

Remember that the parseable syntax does not yield a name.