Skip to content

What Is a Doji Candlestick? A Beginner’s Field Guide

What is a doji candlestick? A visual sign of market indecision - plus what backtests actually say about its reliability and how to spot one in code.

8 min readBeginner

You’re staring at a chart. One candle looks weird – barely a body, just a thin horizontal line with wicks sticking out top and bottom, like a crooked plus sign. You want to know two things: what it means, and whether you should actually do anything about it.

That candle is a doji. By the end of this guide, you’ll know how to identify it, which variant you’re looking at, what the real backtested numbers say about its reliability, and how to detect one automatically in Python if you’re building a screener.

The scenario: you just spotted one on a live chart

Picture the moment. Price has been climbing for six sessions. Then today’s candle closes almost exactly where it opened. The body is a sliver. The wicks stretch above and below.

That’s the read: buyers pushed, sellers pushed back, and by the close nobody won. According to TradingSim’s pattern reference, a doji candlestick forms when a security’s open and close prices are virtually equal, creating a cross or plus-sign shape – signaling that neither buyers nor sellers gained control during the session. The question that matters isn’t “is this a doji?” – it’s “what does this doji, in this spot on the chart, actually tell me?”

Short answer: on its own, almost nothing. In context, sometimes a lot.

What is a doji candlestick, technically

The definition is simple but the threshold is fuzzy. No universal rule exists for how close open and close need to be. Most detection code uses a ratio: the body must be less than 10% of the full candle’s range. Arbitrary line – but it’s the community standard, and two charting tools can legitimately disagree on whether the same candle qualifies.

The four wick/body configurations you’ll actually see:

  • Standard doji – small body, roughly equal wicks above and below. The classic plus sign.
  • Long-legged doji – same tiny body, but the wicks are unusually long. High volatility, big fight, no winner.
  • Dragonfly – open, close, and high are approximately the same, so visually it looks like a “T” (per Dukascopy’s doji reference). Sellers pushed price way down; buyers dragged it all the way back.
  • Gravestone – inverted T. Buyers surged, sellers crushed the rally back to the open. The mirror opposite of the dragonfly.
  • Four price doji – open, close, high, and low are all identical. A single horizontal line.

That last one deserves a flag. The Four Price Doji is most commonly seen in markets with low volume or limited liquidity (Dukascopy). If you spot one, your first suspicion should be “thin trading,” not “profound market indecision.” It’s usually noise from an illiquid symbol or a dead session – not a signal worth acting on.

The uncomfortable truth: what backtests actually show

Here’s what almost every doji tutorial leaves out. Real numbers.

The most-cited study – an 8,029-trade backtest spanning 548 years of data (Liberated Stock Trader) – landed on a result that isn’t flattering: a 55.6% win rate and a 0.40 Sharpe ratio. A coin flip is 50%. So the raw doji is barely better than random.

Context changes things. Turns out that across 500+ stocks, dojis at trend extremes hit around 57% – raw patterns without filters fell in the 48-55% range (BacktestMe). Stack support/resistance filters on top of a trend context, and one 2026 study by Volity Performance Lab reports Dragonfly Dojis at established support zones reaching a 77% win rate when filtered by a 10-day moving average. That’s a real gap – 55% vs. 77% – driven entirely by context, not by the candle itself.

The doji is a flashlight, not a map. It shows you where to look; it doesn’t tell you where to go. Trade the doji + location + confirmation – never the doji alone.

One thing none of those numbers tell you: how long those studies’ market conditions stayed relevant. The 548-year dataset is impressive for sample size, but market microstructure in 2024 is not 1476. Treat win-rate figures as directional guidance, not hard targets.

How to detect a doji in Python (the beginner setup)

Stop hunting dojis by eye. Two paths exist: write the check yourself, or use TA-Lib, which ships a built-in CDLDOJI function for exactly this.

The DIY version is one line of logic – body divided by total range:

import pandas as pd

def is_doji(df, threshold=0.1):
 body = (df['close'] - df['open']).abs()
 total_range = df['high'] - df['low']
 # Avoid divide-by-zero on flat candles
 ratio = body / total_range.replace(0, 1e-9)
 return ratio < threshold

# Usage: df is a DataFrame with open, high, low, close columns
df['is_doji'] = is_doji(df)
print(df[df['is_doji']].tail(10))

The 0.1 threshold comes from the EODHD community detection guide and is a reasonable default. Tighten it to 0.05 if you want stricter matches; loosen it on volatile assets if you’re getting too few hits.

One gotcha worth flagging: TA-Lib and this ratio method will disagree on some candles. TA-Lib normalizes against the average recent range; the ratio above uses only the current candle. Same input data, different verdicts on edge cases. Pick one approach, document it, and be consistent – mixing them makes backtests non-reproducible.

The confirmation candle question

Every doji tutorial ever written tells you to “wait for a confirmation candle.” What they skip is the cost.

BacktestMe’s testing shows confirmation (waiting for the next candle to close in the pattern direction) cuts false signals by around 30%. The catch: you also miss roughly 20% of big moves that happen immediately. Higher accuracy on the trades you take, but you sit out some of the fastest wins.

Which is better? Depends on whether your account can absorb a run of small losses to catch the occasional large move, or whether win rate matters more for your psychology. That’s not really a chart question – it’s a you question.

Honest limitations

Three things a doji cannot do:

  1. Predict direction. A doji says “the fight is even.” It doesn’t say who wins next. Any tutorial reading a doji as “bullish” or “bearish” in isolation is making an inference the candle itself doesn’t support.
  2. Signal reliably at small scale. On a 1-minute chart, dojis appear constantly – most are just quiet minutes with no volume behind them. The pattern’s statistical properties come from studies run on daily data; applying those expectations to intraday charts is a category error.
  3. Replace a strategy. Backtests consistently show single-pattern strategies underperform a diversified approach. The doji is an ingredient. Not the recipe.

If you’re building a screener or a systematic strategy around dojis, benchmark against a random-entry baseline. If your doji strategy can’t beat random entries by more than the spread and commission drag, the pattern isn’t adding signal – you’re just paying transaction costs to feel clever.

Frequently Asked Questions

Is a doji bullish or bearish?

Neither – by definition. The bias comes entirely from location: dragonfly after a downtrend hints bullish, gravestone after an uptrend hints bearish, standard doji mid-range hints nothing.

How close do open and close need to be to count as a doji?

No official standard exists – that’s actually the gotcha most guides skip. The community default is a body-to-range ratio below 0.1, meaning the body is less than 10% of the full candle including wicks. TA-Lib calculates this differently, normalizing against the recent average range rather than the single candle. Practical consequence: the same candle can pass your custom threshold and fail TA-Lib’s check (or vice versa). If you’re backtesting, pick one method, document it explicitly, and never mix the two in the same test – your results won’t be reproducible if you do.

Can I trade dojis on crypto?

You can, but expect more noise. Crypto runs 24/7 with thinner order books on most pairs, so dojis appear more frequently and carry less statistical weight per occurrence. Four Price Dojis in particular are common on low-volume altcoins during dead hours – nearly always a liquidity artifact, not a real signal. If you want the pattern to carry weight, stick to major pairs (BTC, ETH) on the daily or 4-hour chart, apply the same trend-context and support/resistance filters that pushed the dragonfly’s win rate toward 77% in the Volity Performance Lab study, and treat the 55.6% baseline as your floor – not your target.

Next step: pull the last 6 months of daily OHLC data for one asset you actually follow, run the is_doji function above, then manually check what happened 3 and 10 sessions after each hit. That 30-minute exercise will teach you more about dojis than any tutorial – including this one. The Liberated Stock Trader backtest breakdown is worth reading alongside your own results to see how much your specific asset deviates from the 8,029-trade aggregate.