« GeniusTrader/Signals/Graphical/CandleSticks/GravestoneDoji.pm
↑ Summary
GeniusTrader/Signals/Graphical/CandleSticks/InvertedHammer.pm »
| 1 | package Finance::GeniusTrader::Signals::Graphical::CandleSticks::Hammer; | ||
| 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 = ("Hammer"); | ||
| 16 | |||
| 17 | =head1 Finance::GeniusTrader::Signals::Graphical::CandleSticks::Hammer | ||
| 18 | |||
| 19 | =head2 Overview | ||
| 20 | |||
| 21 | The Hammer Pattern is formed by a short body at the top of a long trail. Hammers must occur at the end of significant trends to have meaning. | ||
| 22 | |||
| 23 | Hammers indicate indecision in the direction of the trend. A black (solid) hammer which occurs at the end of an uptrend is called a Hanging Man. Thsi type of Hammer indicates the market's propensity to sell off sharply. However, one should wait for the next session to confirm the bearish mood (i.e., for the market to open below the close of the hammer). On the other hand, white (open) Hammers which occur at the end of downtrends show strength for a reversal to the upside, since the bulls are clearly bucking the downtrend to close near the open for the session. | ||
| 24 | |||
| 25 | =head2 Construction | ||
| 26 | |||
| 27 | A Hammer occurs when the high, open and close occur at roughly the same | ||
| 28 | price, but the low of the day is far below. | ||
| 29 | |||
| 30 | =head2 Representation | ||
| 31 | |||
| 32 | ___ _|_ | | ||
| 33 | | | | | | ### ### | ||
| 34 | --- --- |___| |___| ### ### | ||
| 35 | | | | | | | | ||
| 36 | | | | | | | | ||
| 37 | | | | | | | | ||
| 38 | |||
| 39 | 48 52 80 84 32 36 | ||
| 40 | |||
| 41 | =head2 Links | ||
| 42 | |||
| 43 | http://www.equis.com/free/taaz/candlesticks.html | ||
| 44 | |||
| 45 | =cut | ||
| 46 | sub new { | ||
| 47 | my $type = shift; | ||
| 48 | my $class = ref($type) || $type; | ||
| 49 | my $args = shift; | ||
| 50 | |||
| 51 | my $self = { "args" => defined($args) ? $args : [] }; | ||
| 52 | |||
| 53 | return manage_object(\@NAMES, $self, $class, $self->{'args'}, ""); | ||
| 54 | } | ||
| 55 | |||
| 56 | sub initialize { | ||
| 57 | my ($self) = @_; | ||
| 58 | |||
| 59 | $self->{'cndl'} = Finance::GeniusTrader::Indicators::CNDL->new($self->{'args'}); | ||
| 60 | |||
| 61 | $self->add_indicator_dependency($self->{'cndl'}, 1); | ||
| 62 | } | ||
| 63 | |||
| 64 | sub detect { | ||
| 65 | my ($self, $calc, $i) = @_; | ||
| 66 | my $cndl_name = $self->{'cndl'}->get_name(0); | ||
| 67 | my $hammer_name = $self->get_name(0);; | ||
| 68 | |||
| 69 | return if ($calc->signals->is_available($self->get_name(0), $i)); | ||
| 70 | return if (! $self->check_dependencies($calc, $i)); | ||
| 71 | |||
| 72 | my $cndl_code = $calc->indicators->get($cndl_name, $i); | ||
| 73 | |||
| 74 | if (($cndl_code eq 32) or ($cndl_code eq 48) or ($cndl_code eq 80) or | ||
| 75 | ($cndl_code eq 36) or ($cndl_code eq 52) or ($cndl_code eq 84)) { | ||
| 76 | $calc->signals->set($hammer_name, $i, 1); | ||
| 77 | } else { | ||
| 78 | $calc->signals->set($hammer_name, $i, 0); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | 1; |