NAME

Finance::GeniusTrader::Calculator - All data (of a single share) used for calculations

DESCRIPTION

This is a facility object to ease the collaboration between Finance::GeniusTrader::Prices and Finance::GeniusTrader::CacheValues. It contains the prices (Finance::GeniusTrader::Prices), and the result of various indicators and signals within two Finance::GeniusTrader::CacheValues object. This object is manipulated by all the indicators, signals and systems.

A calculator can contain the same serie of prices but indexed on different time frames.

my $c = Finance::GeniusTrader::Calculator->new($prices [, $code])

Create a new Finance::GeniusTrader::Calculator object with $prices used for calculations. The calculator is associated to share named $code.

$c->prices()
$c->indicators()
$c->signals()

Return the corresponding object of the current timeframe.

$c->prices_on_timeframe($timeframe)
$c->indicators_on_timeframe($timeframe)
$c->signals_on_timeframe($timeframe)

Return the corresponding object of the indicated timeframe. Learn more about the timeframes in Finance::GeniusTrader::DateTime.

$c->set_code($code)

Sets the code of the share which datas are stored in this object.

$c->code()

Returns the code of the share associated with this object.

$calc->set_current_timeframe($timeframe)

Changes the current timeframe to the indicated one. If the timeframe doesn't exist, it tries to create it. Returns 1 on success and 0 on failure.

$calc->current_timeframe()

Returns the current timeframe.

$calc->create_timeframe($timeframe)

Create the given timeframe with an other serie of prices available in the calculator. Returns 1 on success and 0 on failure.

$calc->available_timeframe()

Returns the sorted list of available timeframes.

$calc->timeframe_is_available()

Returns true if the given timeframe is available in the calculator. Otherwise returns false.