Doji
A doji is a candlestick whose open and close land at, or almost at, the same price, collapsing the real body to a thin line while the shadows record the session's full travel. Doji, also known as long-legged, four-price variants, is a Chart & Candlestick Patterns concept. The Library holds 1 implementation, ready to run on Vela.
Top Doji indicator
The top custom implementation, built on the original standard Doji formula.
1 total
From studying Doji to trading it: open the implementation below on Vela, then build a strategy on it with Quant and backtest it.
What is a Doji?
A doji is a candlestick whose open and close land at, or almost at, the same price, collapsing the real body to a thin line while the shadows record the session's full travel. In candlestick vocabulary it is the indecision candle: both sides moved price during the period, but neither side held the gain by the close. Wick structure defines the variants. A long-legged doji has long shadows on both sides; a dragonfly doji opens and closes near the high above a long lower shadow; a gravestone doji opens and closes near the low beneath a long upper shadow; the rare four-price doji prints when all four prices are equal, usually on very thin trading.
A doji carries little information on its own; its weight comes from location. After a sustained advance or decline it shows the trend failed to extend into the close, which is why candlestick tradition treats it as an early trend exhaustion warning rather than a reversal signal in itself. Inside a quiet range, near-zero bodies are routine and mean little. 'Nearly equal' is also a judgment call: coded detectors typically require the body to be a small fraction of the high-low range, and the exact threshold is a convention that varies by source, so two scanners can disagree about the same candle.
How to identify a Doji
Recognition reduces to a body-to-range comparison plus context.
- 1Compare open and close. The real body should be a small fraction of the candle's total high-low range; exact thresholds are conventions, so make yours explicit and consistent if you code it.
- 2Classify the variant from the shadows: long on both sides (long-legged), lower shadow dominant with the body at the top (dragonfly), upper shadow dominant with the body at the bottom (gravestone).
- 3Weigh the location. A doji after an extended leg or at a tested S/R zone is a meaningful stall; a doji in the middle of a quiet range is noise.
- 4Wait for the next candle. Direction comes from the confirmation bar, not the doji itself: a decisive close away from the doji's range is the usual trigger.
How traders use it
- As a stall warning inside trends: a doji after a directional leg says the last push found no acceptance, prompting tighter stops or partial profit-taking rather than an immediate counter-trend entry.
- As the hinge of multi-candle reversal patterns: the morning star and evening star build around a small-bodied middle candle, a doji in their 'doji star' variants, and a doji as the second candle of a harami is read as a 'harami cross'.
- At levels: a doji forming at support, resistance, or a prior swing extreme frames a contested auction, and traders commonly set triggers beyond the doji's high and low so the market picks the direction.
- In scanners and scoring systems: because the definition reduces to a body-to-range ratio, doji detection is cheap to code and usually serves as one confluence input among several rather than a standalone signal.
Doji vs similar patterns
Spinning Top: A spinning top has a small but clearly visible real body between two shadows; a doji's open and close are essentially equal. Both read as indecision, with the doji the more extreme statement of it.
Hammer: A hammer keeps a real body at the top of the range above a long lower shadow and appears after a decline; the dragonfly doji is its no-body cousin. Both describe rejection of lower prices, but the hammer's definition requires the downtrend context.
Harami: A harami is a two-candle containment pattern: a small real body inside the prior candle's body. A doji is a single candle; when the contained second candle is a doji, the combination is called a harami cross.
Doji FAQ
Turn Doji into a trading strategy.
Open the implementation from this page in Vela. Quant, our coding agent, builds the strategy with you and backtests it on real data.
Browse this familyChart & Candlestick Patterns88 concepts mapped · 88 in the Library
- Abandoned Baby
- Ascending Base
- Ascending/descending/symmetrical Triangle
- Bart Pattern
- Belt Hold
- Breakaway Gap
- Breakout Confirmation
- Broadening Formation
- Bull/bear Flag
- Bullish/bearish Engulfing
- Bump-and-run Reversal
- Candlestick Patterns
- Channel Continuation
- Classic Bar Setups
- Common Gap
- Complex H&S
- Cup & Handle
- Cup-with-handle Base
- Dark Cloud Cover
- Dead-cat Bounce
- Diamond Top/bottom
- Doji
- Double Top/bottom
- Double-bottom Base
- Dragonfly Doji
- Engulfing Bar
- Evening Star
- Exhaustion Bar
- Exhaustion Gap
- Final Flag
- Flat Base
- Gap Fill
- Gap-and-go
- Gravestone Doji
- Hammer
- Hanging Man
- Harami
- Head & Shoulders
- High Tight Flag
- High-wave Candle
- Hikkake
- Inside Bar
- Inverse Head & Shoulders
- Inverted Hammer
- IPO Base
- Island Reversal
- Key Reversal
- Kicking
- Marubozu
- Mat Hold
- Matching Low/high
- Measure Rule
- Measured-move Up/down
- Morning Star
- O'Neil Base Analysis
- On-neck / In-neck / Thrusting
- Outside Bar
- Pennant
- Piercing Line
- Pin Bar
- Rare Candlestick Formations
- Rare Reversal Patterns
- Rectangle
- Rising/falling Three Methods
- Rising/falling Wedge
- Rounding Top/bottom
- Runaway Gap
- Scallop
- Shooting Star
- Spike and Channel
- Spinning Top
- The Strat
- Three Black Crows
- Three Inside Up/down
- Three Outside Up/down
- Three Rising Valleys/falling Peaks
- Three White Soldiers
- Three-bar Reversal
- Tri-star
- Triple Top/bottom
- Tweezer Top/bottom
- Two-bar Reversal
- Upside/downside Tasuki Gap
- V-top/V-bottom
- Volume Signature per Pattern
- Weekend Gap
- Wide-range Bar
- Wolfe Waves
