In this article
After this article, you can
- Check whether an apparent doji comes from data or formatting.
- Calculate the body before display rounding.
Terms at hand: Pip · Backtesting · Trading Journal · Balance · Liquidity · Stop loss
A spinning top has a small body and visible shadows on both sides; a doji has Open close to Close under a declared rule. These shapes are often called indecision candles, but they do not measure participants’ psychology or the balance of all orders. Start with recorded prices and detector settings. Geometry is separate from a hypothesis about the next bar and from an executed trade.
What is a spinning top and what is a doji?
For ordinary price candles, range R = H − L, body B = |C − O|, upper shadow U = H − max(O, C) and lower shadow D = min(O, C) − L. Validate that O and C lie within [L, H] and B + U + D = R. A small body need not mean a small intrabar move, and upper/lower shadows need not be equal.
Use an explicit custom classification for this lesson: when R > 0, doji means B/R ≤ 5%. A spinning top requires 5% < B/R ≤ 25%, with each shadow at least 25% of R. Equality at 5% belongs to doji. These are exercise thresholds, not universal or validated trading parameters. The Japanese candlestick patterns guide explains ordinary OHLC construction; chart labels alone do not establish a statistical frequency or direction.
What are the doji variants and what sets them apart?
The examples below are separate candles, not consecutive observations in a real session. The spinning top has B/R = 10%, U/R = 40% and D/R = 50%, so it passes our custom rule. Swapping its O and C keeps those lengths and changes only body colour.
| Shape | O / H / L / C | R | B / U / D |
|---|---|---|---|
| Spinning top | 100 / 105 / 95 / 101 | 10 | 1 / 4 / 5 |
| Doji | 100 / 105 / 95 / 100 | 10 | 0 / 5 / 5 |
| Long-legged | 100 / 110 / 90 / 100 | 20 | 0 / 10 / 10 |
| Dragonfly | 100 / 100 / 90 / 100 | 10 | 0 / 0 / 10 |
| Gravestone | 100 / 110 / 100 / 100 | 10 | 0 / 10 / 0 |
| Four-price | 100 / 100 / 100 / 100 | 0 | 0 / 0 / 0 |
In ideal dragonfly geometry O = C = H with a lower shadow; gravestone has O = C = L and an upper shadow. Standard doji does not require equal shadows. Four-price doji has O = H = L = C, so R = 0: handle it separately before dividing B by R. It establishes no recorded price range, not a measurement of all-market liquidity or a count of orders. None of these names guarantees reversal.
A doji records a close near its open. Its shadows show the recorded range, not the identity or intentions of market participants.
Explicit settings can produce different labels
TA-Lib 0.6.4 compares a doji’s body with 10% of the mean High–Low range of the ten preceding candles, excluding the current one. Its spinning-top detector instead requires a body shorter than the preceding mean body and both current shadows longer than that body. Those defaults do not reproduce our custom percentage rules. Record the version and settings before counting labels near support or resistance. A location does not turn a count into a tested entry.
The site’s previously published analysis, dated 2 October 2026, compares 120 closed Kraken EUR/USD H1 trade-price candles from 21 September 2026 00:00 UTC through 25 September 23:00 UTC. Ten earlier candles only warm up the prior-range mean. This is one spot market, not a broker Bid/Ask feed or the whole Forex market.
| Custom 5% rule | TA-Lib doji | TA-Lib not doji | Total |
|---|---|---|---|
| Doji | 10 | 1 | 11 |
| Not doji | 9 | 100 | 109 |
| Total | 19 | 101 | 120 |
Ten labels differ. The published 3% and 10% checks yield 7 and 14 recognitions; the original methodology records 120/120 reference agreement with C TA-Lib 0.6.4. These are classification results, not a win rate or a new trading study. More labels do not establish accuracy or profitability. The published CSV contains derived features rather than full source OHLC, so checking those features alone cannot independently replicate the study from market prices.
Check the published archive: 120 classifications and derived features (CSV), analysis code and manifest (ZIP), and methodology and calculator (in Polish). These files remain on our Polish site. The CSV and ZIP do not contain the provider’s original OHLC data.
What does it look like in an example?
Two published discrepancies show why the denominator matters. On 21 September 23:00 UTC, body 0.5 pips and current range 2 pips give B/R = 25%, failing 5%; the preceding mean range 8.6 gives TA-Lib threshold 0.86 pips, which passes. On 23 September 14:00, body 3.6 pips and range 232.1 give about 1.55%, passing 5%, but the preceding mean 15.53 gives threshold 1.553 pips, which fails. Here one pip is 0.0001 USD/EUR. The unusual high is retained in the original archive; same-provider M30 consistency reported in the methodology does not establish its cause or independent market confirmation.
“Long” needs a benchmark. For the arbitrary-unit long-legged row above, assume each prior range is 8: R/8 = 2.5 and both shadows are 50% of R. The ordinary doji row has R/8 = 1.25 and fails our added requirement of R at least twice the prior mean. These are custom illustration rules, not default platform settings. A next-bar break can be another declared event, but it does not guarantee reversal or a sensible short entry.
Equal screen labels do not mean a zero body
Source O100.01 and C100.04 differ by 0.03. Range H−L is 0.40, so the body is 7.5%. A one-decimal display shows 100.0 for both. Classification from that label loses a difference retained in the data.
Under the article's custom 5% rule, this candle is not a doji because 7.5% >5%. This separate example concerns display precision and does not alter the 120-candle study described above. Pass full values to CSV and the detector. Check label format, export precision and minimum price increment separately before comparing classifications.
Assumptions: one separate, entirely hypothetical candle: O100.01, H100.20, L99.80, C100.04. One-decimal rounding applies only to the display. The article's 5% rule uses recorded values.
How do you use these candles without falling into traps?
OHLC also does not reconstruct the intrabar sequence. Paths 100 → 105 → 95 → 100 and 100 → 95 → 105 → 100 give the same ordinary doji. They establish neither which side took control first nor how long price stayed at each level. On an open bar with O 100, H 105 and L 95, current C 100 gives a doji; final C 104 gives B/R = 40%, failing both custom doji and spinning-top rules. A closed-bar decision can only use the final shape after close.
A trading rule separately needs context, decision time, executable entry and exit, size and costs. Comparing a hammer, engulfing pattern or Harami requires their own definitions; calling them stronger does not establish higher profitability. A stop beyond a candle extreme is a chosen rule, not a promised maximum loss or proof that the trade premise is universally invalid there.
What to do tomorrow
- Record the definition, source, interval, price side, time zone, threshold and detector version. State how zero ranges and equality at a boundary are handled.
- Calculate body and shadows from full prices. Identify ideal dragonfly, gravestone and long-legged geometry without treating their names as direction guarantees.
- Use confirmed bars if that is the decision rule. Do not assign a later shape or confirmation to an earlier entry, and retain cases that fail the conditions.
- Check disagreements between detectors. Compare the current range with the prior mean, including unusual highs; a shared provider’s second interval is a consistency check, not independent confirmation.
- Use the technical analysis section to define a strategy separately. Specify all entries, exits, costs and failures before evaluation on unused data; two weeks of watching or a candle label does not establish an edge.
Check your understanding
One short exercise
About 2 min · you can try again
O100.01, C100.04, H100.20, L99.80. Are two 100.0 labels enough to qualify a doji under the 5% threshold?
- Yes because rounding removes the body.
- Unknown because the range is zero.
- No:full data give a 7.5% body share.
Check the answer and explanation
No:full data give a 7.5% body share.
0.03/0.40 =7.5%, above 5%. Equal display labels do not change the data.
Frequently asked
What is the difference between a spinning top and a doji?
What geometries distinguish the doji variants?
Can you trade on a spinning top or doji alone?
Sources & bibliography
-
StockCharts ChartSchool Introduction to Candlesticks · Educational reference on candlestick anatomy — body and shadows — and the indecision candles, including the doji and the spinning top. chartschool.stockcharts.com ↗
-
StockCharts ChartSchool Candlestick Pattern Dictionary · Alphabetical reference of candlestick patterns including the doji variants — dragonfly, gravestone, long-legged — and the spinning top, with definitions. chartschool.stockcharts.com ↗
-
StockCharts ChartSchool Candlestick Charts — Education Hub · Overview of candlestick analysis covering reversal patterns, support and resistance applications and the role of confirmation and trend context. chartschool.stockcharts.com ↗
-
Candlecharts.com (Steve Nison) Candlestick Trading Courses — Shop · Steve Nison’s website offering candlestick trading courses. candlecharts.com ↗
-
TA-Lib — version 0.6.4 CDLDOJI detector source · The body is compared with a declared candle average; the current candle is excluded from the prior-range mean. A positive detection code does not mean a bullish forecast. raw.githubusercontent.com ↗
-
TA-Lib — version 0.6.4 Default candlestick settings — ta_global.c · BodyDoji uses ten prior High–Low ranges with factor 0.1; BodyShort uses ten prior real bodies. These versioned defaults differ from the lesson’s custom percentage rules. raw.githubusercontent.com ↗
-
Kraken Get OHLC Data — Spot REST documentation · The endpoint returns a limited recent window and includes an uncommitted last bar. The saved September sample is one market’s trade-price data, not a complete broker Bid/Ask feed. docs.kraken.com ↗
