16 — Candlestick Patterns

Doji#

IndecisionHeuristic1 min read
◆ The PatternOpen ≈ Close — the market is undecided

A Doji forms when the open and close are nearly equal, creating a cross or plus shape. It signals indecision — neither buyers nor sellers won. Context is everything: at a trend extreme, it suggests reversal; mid-range, it's noise.

Variants: Standard (+), Long-legged, Dragonfly (T), Gravestone (⊥)
A doji after a long green candle suggests the uptrend may be stalling — buyers ran out of conviction.
// Doji variants
Key insight: A single doji means nothing in isolation — it needs context. After a strong move, it's significant. In a sideways range, it's normal.
Pattern bridge: Open equals close — perfect indecision, a mean equal to median moment. In ML, a loss of zero at a saddle point looks the same: no net direction.
Worked example

The last bar opens at 100.2 and closes at 100.0, inside a range of 98 to 102: a body of 0.2 against a range of 4, or 5%. Under the 10% threshold, so a doji — after two down days, a session where neither side won.

The example data

The bars the example is worked on.

BarOpenHighLowClose
1103104101.5102
2102102.5100100.5
3100.210298100
Where it misleads
  • It signals indecision, not reversal; the next bar decides, and on its own a doji predicts little.
  • The 10% threshold is arbitrary, and on quiet days many bars qualify.
  • Opening and closing prices differ slightly between data vendors, so whether a bar is a doji can depend on the source.
In code
o, h, l, c = df.iloc[-1][['open', 'high', 'low', 'close']]
body, rng = abs(c - o), h - l
is_doji = body <= 0.1 * rng                           # body under 10% of the day's range
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
Rectangle
Open in the full reader, with the topic sidebar