Doji Candlestick Pattern

The doji is a candle where the open and close are virtually the same, creating a cross-like shape. It represents indecision between buyers and sellers. While not a strong directional signal on its own, a doji at a key level after a strong move can precede significant reversals.

Types of Doji

There are several doji variants, each telling a slightly different story:

  • Standard Doji — small body with roughly equal upper and lower shadows. Pure indecision.
  • Long-Legged Doji — very long shadows on both sides. Extreme indecision with high volatility.
  • Dragonfly Doji — long lower shadow, no upper shadow. Similar to a hammer; bullish implications after a decline.
  • Gravestone Doji — long upper shadow, no lower shadow. Bearish implications after an advance.

What counts as 'virtually the same' open and close?

The usual systematic rule is that the body must be ≤ 5% of the bar's total range:

``` isDoji = math.abs(close - open) <= (high - low) * 0.05 and barstate.isconfirmed ```

This threshold is what distinguishes a doji from a spinning top (small but visible body, typically 5–30% of range) and from a hammer or shooting star (small body up to ~35% of range, distinguished by wick asymmetry). The 5% threshold is not universal — some systematic traders loosen it to 10% for intraday charts where true zero-body bars are rare — but 5% is the cleanest default for daily and higher timeframes.

With that rule you can also mechanically detect the sub-variants:

  • Dragonfly: standard doji AND `(high - math.max(close, open)) <= range * 0.1` (essentially no upper wick)
  • Gravestone: standard doji AND `(math.min(close, open) - low) <= range * 0.1` (essentially no lower wick)
  • Long-legged: standard doji AND both wicks are individually `>= body * 3` — the bar has significant range despite its near-zero body.

A doji by itself is not a trade signal. It is a warning that the balance of power between buyers and sellers has shifted to equilibrium. The candle that follows the doji is what confirms direction.

Using Doji Candles in a System

The practical approach to doji trading:

  • After a strong trend — a doji at resistance (in an uptrend) or support (in a downtrend) can signal exhaustion
  • Wait for confirmation — enter only when the next candle closes in the expected reversal direction
  • Combine with volume — a doji on declining volume suggests genuine indecision rather than just a pause

Doji candles are most useful as filters rather than triggers. For example, you might avoid entering a trend-following trade if a doji has just formed, suggesting momentum is fading.