# Copyright 2007, 2008, 2009, 2010 Kevin Ryde # This file is part of Chart. # # Chart is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 3, or (at your option) any later version. # # Chart is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along # with Chart. If not, see . package App::Chart::Series::OHLCVI; use 5.010; use strict; use warnings; use Carp; use base 'App::Chart::Series'; use constant default_linestyle => 'Candles'; sub new { my $class = shift; my @opens = (); my @highs = (); my @lows = (); my @closes = (); my @volumes = (); my @openints = (); my $self = $class->SUPER::new (opens => \@opens, highs => \@highs, lows => \@lows, closes => \@closes, volumes => \@volumes, openints => \@openints, arrays => { opens => \@opens, highs => \@highs, lows => \@lows, closes => \@closes, volumes => \@volumes, openints => \@openints }, array_aliases => { 'values' => 'closes'}, @_); return $self; } use constant range_default_names => ('opens', 'highs', 'lows', 'closes'); 1; __END__ =for stopwords OHLCVI =head1 NAME App::Chart::Series::OHLCVI -- series with open, high, low, close, ... =head1 SYNOPSIS use App::Chart::Series::OHLCVI; =head1 CLASS HIERARCHY App::Chart::Series App::Chart::Series::OHLCVI =over 4 =item C<< $series->values_array >> For an OHLCVI series the C method of C is the C. =back =head1 SEE ALSO L, L =cut # =head1 FUNCTIONS # # =over 4 # # =item C<< $series->opens >> # # =item C<< $series->array('highs') >> # # =item C<< $series->lows >> # # =item C<< $series->closes >> # # =item C<< $series->volumes >> # # =item C<< $series->openints >> # # Return an array reference for the respective data, being daily opening # price, day's high, day's low, close, traded volume, and open interest (for # futures contracts). # # These are like the C method (see L). Data is # only loaded into the arrays (into all of them at once) when the C # method is called. So for example # # $series->fill (100, 150); # my $volumes = $series->volumes; # foreach my $t (100 .. 150) { # my $volume = $volumes->[$t]; # if (defined $volume) { print "$volume\n"; } # } # sub opens { # my ($self) = @_; # return $self->array('opens'); # } # sub highs { # my ($self) = @_; # return $self->array('highs'); # } # sub lows { # my ($self) = @_; # return $self->array('lows'); # } # sub closes { # my ($self) = @_; # return $self->array('closes'); # } # sub volumes { # my ($self) = @_; # return $self->array('volumes'); # } # sub openints { # my ($self) = @_; # return $self->array('openints'); # } # *values = \&closes;