« GeniusTrader/Signals/Graphical/CandleSticks/BullishHarami.pm
↑ Summary
GeniusTrader/Signals/Graphical/CandleSticks/Hammer.pm »
| 1 | package Finance::GeniusTrader::Signals::Graphical::CandleSticks::GravestoneDoji; | ||
| 2 | |||
| 3 | # Copyright 2000-2002 Raphaƫl Hertzog, Fabien Fulhaber | ||
| 4 | # This file is distributed under the terms of the General Public License | ||
| 5 | # version 2 or (at your option) any later version. | ||
| 6 | |||
| 7 | use strict; | ||
| 8 | use vars qw(@ISA @NAMES); | ||
| 9 | |||
| 10 | use Finance::GeniusTrader::Signals; | ||
| 11 | use Finance::GeniusTrader::Prices; | ||
| 12 | use Finance::GeniusTrader::Indicators::CNDL; | ||
| 13 | |||
| 14 | @ISA = qw(Finance::GeniusTrader::Signals); | ||
| 15 | @NAMES = ("GravestoneDoji"); | ||
| 16 | |||
| 17 | =head1 Finance::GeniusTrader::Signals::Graphical::CandleSticks::GravestoneDoji | ||
| 18 | |||
| 19 | =head2 Overview | ||
| 20 | |||
| 21 | The Gravestone Doji is a reversal pattern that signifies a turning point. It occurs when the open, close, and low are the same, and the high is significantly higher than the open, low, and closing prices. | ||
| 22 | |||
| 23 | =head2 Representation | ||
| 24 | |||
| 25 | | | ||
| 26 | | | ||
| 27 | | | ||
| 28 | --- | ||
| 29 | |||
| 30 | 79 | ||
| 31 | |||
| 32 | =head2 Links | ||
| 33 | |||
| 34 | http://www.equis.com/free/taaz/candlesticks.html | ||
| 35 | |||
| 36 | =cut | ||
| 37 | sub new { | ||
| 38 | my $type = shift; | ||
| 39 | my $class = ref($type) || $type; | ||
| 40 | my $args = shift; | ||
| 41 | |||
| 42 | my $self = { "args" => defined($args) ? $args : [] }; | ||
| 43 | |||
| 44 | return manage_object(\@NAMES, $self, $class, $self->{'args'}, ""); | ||
| 45 | } | ||
| 46 | |||
| 47 | sub initialize { | ||
| 48 | my ($self) = @_; | ||
| 49 | |||
| 50 | $self->{'cndl'} = Finance::GeniusTrader::Indicators::CNDL->new($self->{'args'}); | ||
| 51 | |||
| 52 | $self->add_indicator_dependency($self->{'cndl'}, 1); | ||
| 53 | } | ||
| 54 | |||
| 55 | sub detect { | ||
| 56 | my ($self, $calc, $i) = @_; | ||
| 57 | my $cndl_name = $self->{'cndl'}->get_name(0); | ||
| 58 | my $gravestone_doji_name = $self->get_name(0);; | ||
| 59 | |||
| 60 | return if ($calc->signals->is_available($self->get_name(0), $i)); | ||
| 61 | return if (! $self->check_dependencies($calc, $i)); | ||
| 62 | |||
| 63 | my $cndl_code = $calc->indicators->get($cndl_name, $i); | ||
| 64 | |||
| 65 | if ($cndl_code eq 79) { | ||
| 66 | $calc->signals->set($gravestone_doji_name, $i, 1); | ||
| 67 | } else { | ||
| 68 | $calc->signals->set($gravestone_doji_name, $i, 0); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | 1; |