GT::Calculator - All data (of a single share) used for calculations
This is a facility object to ease the collaboration between GT::Prices and GT::CacheValues. It contains the prices (GT::Prices), and the result of various indicators and signals within two GT::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 = GT::Calculator->new($prices [, $code])
Create a new GT::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 GT::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.