The hammer has a small body at the top of the candle and a long lower wick, at least twice the body, with little or no upper wick. It looks like a hammer standing on its handle.
It matters after a decline. Sellers pushed price very low, then buyers brought it back near the top: the decline might be ending.
The hanging man has exactly the same shape, but it appears at the top of a rally. It shows that sellers managed to knock price down during the session: an early warning.
Same shape, opposite meaning: the context gives the name. Body colour hardly matters. In both cases, you wait for the next candle to confirm.
Examples
HANA-X (fictional market) : A hammer appears after four red candles (lower wick of 4.2 for a body of 0.8). But the next candle closes below the hammer’s body, and price keeps falling: without confirmation, the pattern failed.
Flash crash of 6 May 2010 (US market) : That day, the Dow Jones lost nearly 1,000 points in minutes, then won back much of it before the close: the daily candle has a very long lower wick. Yet the market kept falling in the following weeks and made a lower low in early July. A long lower wick does not guarantee a bottom.
Key terms
Hammer
Small body on top, lower wick ≥ twice the body, after a decline
Hanging man
Same shape as the hammer, but at the top of a rally
Context
What comes before the pattern: trend, nearby levels