C_Hammer_HangingMan (Function)

image\trumpet2.gif Disclaimer

The C_Hammer_HangingMan function identifies occurrences of two Japanese candlestick patterns;  Hammer and Hanging Man.

Hammer is defined as:

  • The body of the candle is in the upper half of the bar, and the tail is usually twice as long as the body

  • The price trend is declining

  • It can be a red or green candle, but not a Doji

Hanging Man is defined as:

  • The body of the candle is in the upper half of the bar, and the tail is usually twice as long as the body

  • The price trend is advancing

  • It can be a red or green candle, but not a Doji

Syntax

C_Hammer_HangingMan(Length, Factor, oHammer, oHangingMan)

Returns (Integer)

Each pattern is represented by an output parameter (oHammer or oHangingMan) that returns a positive one (1) when the matching candlestick pattern is found on the current bar or returns a zero (0) if the pattern is not found.  The C_Hammer_HangingMan function itself returns a value of 1.

Parameters

Name Type Description
Length Numeric Length used to calculate the average body.
Factor Numeric Threshold factor for the size of body in relation to the range of the bar ( 2 = Tail must be 2x larger than body).
oHammer Numeric Output variable returns a 1 if the Hammer candlestick pattern exists on the current bar, or 0 if the pattern does not exist.
oHangingMan Numeric Output variable returns a 1 if the Hanging Man candlestick pattern exists on the current bar, or 0 if the pattern does not exist.

Example

Plots a ShowMe on the High of the current bar when a Hammer candlestick pattern is found on the current bar based on a Length of 14 and a Factor of 2:

Value1 = C_Hammer_HangingMan(14, 2, oHammer, oHangingMan)

if oHammer = 1 then

 Plot1(High, "Hammer");