Doji Star (CDLDOJISTAR)
Summary
A two-candle reversal pattern: a long real body followed by a doji whose real body gaps away from it (up after a white body, down after a black body). Signals a potential reversal of the prevailing trend. A hit flags a likely trend reversal; true direction depends on the prevailing trend (bullish in a downtrend, bearish in an uptrend), which the code does not itself verify.
Formula
Two candles. Candle 1: long real body (realbody > BodyLong average). Candle 2: doji (realbody <= BodyDoji average). Gap: either candle 1 white (color1) AND candle 2 real body gaps up above it (the real bodies gap up), or candle 1 black (color-1) AND candle 2 real body gaps down below it (the real bodies gap down).
Notes
- Does not verify the prior trend the reversal signal classically assumes.
- Bulkowski's testing contradicts the classic reading for the bullish case: theory says a bullish Doji Star (gapping down after a black candle) should be a bullish reversal, but he found it instead acts as a bearish CONTINUATION 64% of the time — almost 2 out of 3, the opposite of the textbook signal. (thepatternsite.com)
Inputs
inOpen— Open price of each barinHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outInteger— Emits +100 or -100 on a hit, 0 otherwise. Value is -candlecolor(candle1)*100: -100 when candle 1 is white (gap up), +100 when candle 1 is black (gap down)
Output Values
| Value | Meaning |
|---|---|
| -100 | Doji Star gapping up after a strong advance — waning momentum, a bearish warning if it appears in an uptrend |
| 0 | No pattern |
| 100 | Doji Star gapping down after a strong decline — waning momentum, a bullish warning if it appears in a downtrend |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ✅ Candlestick i |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: cdldojistar.c · cdldojistar.yaml
| Native | File |
|---|---|
| C | ta_CDLDOJISTAR.c |
| Rust | cdldojistar.rs |
| Java | Core_CDLDOJISTAR.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Doji Star
See Also
CDLMORNINGDOJISTAR · CDLEVENINGDOJISTAR · CDLDOJI · CDLMORNINGSTAR · CDLEVENINGSTAR