17 — Candlestick Patterns

Hammer#

Bullish ReversalHeuristic1 min read
◆ The PatternLong lower shadow, small body at top — buyers reclaimed

The Hammer has a small body at the top and a long lower shadow (≥2× body length). Sellers pushed price down during the session, but buyers pulled it back up. At a support level or downtrend base, it signals bullish reversal.

Lower shadow ≥ 2× body length, little or no upper shadow
The "Hanging Man" has the same shape but appears at tops — same candle, opposite meaning depending on context.
// Hammer vs. Hanging Man
Key insight: Color matters less than shape — a green hammer is slightly more bullish, but a red hammer at support is still a valid reversal signal.
Pattern bridge: A long lower shadow rejected by buyers — the distribution of the session is heavily skewed. In ML, ReLU similarly rejects negative values, keeping only the upside.
Worked example

After two lower closes the last bar opens at 100, falls to 96, and closes at 100.8 near its high of 101. Body 0.8, lower shadow 4 (five times the body), upper shadow 0.2: a hammer. Sellers pushed the price down 4 points and buyers took it all back.

The example data

The bars the example is worked on.

BarOpenHighLowClose
1104104.5102102.5
2102.5103100.5101
310010196100.8
Where it misleads
  • It needs a decline before it; the same bar after a rise is a “hanging man” and read the opposite way.
  • Most definitions require confirmation — a higher close the next day. Without it the bar is just a long shadow.
  • Tests of candlestick rules on U.S. stocks found no value after costs (Marshall, Young & Rose 2006).
In code
o, h, l, c = df.iloc[-1][['open', 'high', 'low', 'close']]
body = abs(c - o)
lower = min(o, c) - l                                 # lower shadow
upper = h - max(o, c)                                 # upper shadow
after_fall = df['close'].iloc[-3] > df['close'].iloc[-2]
is_hammer = after_fall and lower >= 2 * body and upper <= body
Python, in your browser — edit the code and run it again

Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns open, high, low and close for the data above.

Sources
  • Japanese Candlestick Charting Techniques, S. Nison, New York Institute of Finance, 1991
  • B. R. Marshall, M. R. Young & L. C. Rose, “Candlestick technical trading strategies: Can they create value for investors?”, Journal of Banking & Finance 30(8), 2006 — they found none on Dow Jones stocks

Last reviewed October 2026 · How this site checks its content · Report a mistake

Linked from 1
← Previous
Doji
Open in the full reader, with the topic sidebar