Candlestick patterns¶

The 61 classic candlestick patterns — doji, hammer, engulfing, morning star,
three black crows — recognized directly from OHLC bars. Every pattern is a
single pl.Expr, so detection runs vectorized alongside the rest of your
feature pipeline.
The pattern definitions follow TA-Lib, the de-facto reference for this family. The implementation is a Polars rewrite, not a port: TA-Lib walks one bar at a time carrying running sums and mutable state, while these compile to shifts and rolling windows over columns.
What a pattern returns¶
| Value | Meaning |
|---|---|
100 |
Bullish occurrence |
-100 |
Bearish occurrence |
0 |
Pattern not present on this bar |
null |
Warm-up — not enough history to decide |
Patterns that are inherently one-sided (a hammer is always bullish) return
100/0. Patterns that occur in both directions — engulfing, harami,
marubozu — return the signed value, taken from candle color or from which side
the setup formed on.
Warm-up is null, not zero
This is the one deliberate divergence from TA-Lib, which reports 0 for
bars it could not evaluate. Here a 0 always means "I checked, no pattern"
and null means "not enough history to check" — so a warm-up bar can never
be mistaken for a genuine negative when these become model features.
Quick start¶
Every function defaults to the conventional open/high/low/close column
names, so the common case needs no arguments:
import polars as pl
from polars_ta import candles
df.with_columns(
candles.cdl_engulfing().alias("engulfing"),
candles.cdl_hammer().alias("hammer"),
candles.cdl_morning_star().alias("morning_star"),
)
Custom column names, the expression namespace, and per-symbol frames all behave as they do everywhere else in the library:
candles.cdl_doji("o", "h", "l", "c") # custom column names
pl.col("open").ta.cdl_doji() # namespace (binds to `open`)
df.with_columns(candles.cdl_harami().over("symbol")) # multi-asset
Computing all 61 at once¶
ALL_PATTERNS maps each name to its function, which makes the whole family one
with_columns call:
df.with_columns(fn().alias(name) for name, fn in candles.ALL_PATTERNS.items())
To collapse them into a single score — how many bullish patterns fired minus how many bearish ones, a common feature-engineering shortcut:
score = pl.sum_horizontal(
[fn().fill_null(0) for fn in candles.ALL_PATTERNS.values()]
) / 100
df.with_columns(score.alias("candle_score"))
How thresholds are decided¶
A pattern like "hammer" is not a crisp predicate — it needs a notion of "short
body" and "long lower shadow", and those only mean something relative to
recent candles. TA-Lib solves this with a settings table mapping each
qualitative term to a (range type, average period, factor) triple, and this
library keeps that idea:
| Term | Measured against | Period | Factor |
|---|---|---|---|
BodyLong |
real body | 10 | 1.0 |
BodyVeryLong |
real body | 10 | 3.0 |
BodyShort |
real body | 10 | 1.0 |
BodyDoji |
high-low range | 10 | 0.1 |
ShadowLong |
real body | 0 | 1.0 |
ShadowVeryLong |
real body | 0 | 2.0 |
ShadowShort |
both shadows | 10 | 1.0 |
ShadowVeryShort |
high-low range | 10 | 0.1 |
Near |
high-low range | 5 | 0.2 |
Far |
high-low range | 5 | 0.6 |
Equal |
high-low range | 5 | 0.05 |
So BodyDoji means "body no larger than 10% of the average high-low range of
the previous 10 candles". Because the thresholds are relative, a pattern
means the same thing on a $3 stock and a $3,000 one, and adapts as volatility
regimes shift. A period of 0 means "compare against this same candle" — used
by the shadow terms, which judge a shadow against its own body.
Two details are load-bearing:
- The average excludes the candle being judged. The threshold at bar
iis built from bars[i-period, i-1], so a candle never helps set the bar it is measured against. (A naiverolling_meangets this wrong, and it matters most on exactly the outlier candles the patterns care about.) - The
Shadowsrange type is halved, since it sums two shadows.
Thresholds live in polars_ta._candle_internal.CANDLE_SETTINGS. Adjusting a
value there retunes every pattern that uses that term coherently — which is the
main reason to keep a table instead of scattering constants across 61 functions.
Patterns are not signals¶

The frequency chart above is a useful reality check. Over 5,000 real BTCUSDT
5-minute bars, belt hold fires on over a thousand of them while thrusting
fires once. Common patterns are mostly noise at this timeframe; rare ones give
you too few observations to fit anything on.
Treat these as features, not trading signals
Candlestick patterns are weak, noisy predictors on their own, and the literature on their standalone edge is not encouraging. They are most useful as conditioning features — combined with trend, volatility, or volume context, or as inputs to a model that can learn when they matter. Nothing in this library validates that a pattern has predictive value on your data; measure that yourself before trading it.
A reasonable way to use them is as context-gated features — for example, only treating a bullish reversal pattern as interesting when the market is already oversold:
from polars_ta import candles, momentum
df.with_columns(
(
(candles.cdl_hammer() == 100) & (momentum.rsi("close", 14) < 30)
).alias("hammer_in_oversold")
)
Pattern reference¶
The 61 patterns, grouped by how many candles they inspect:
| Candles | Patterns |
|---|---|
| 1 | cdl_doji, cdl_dragonfly_doji, cdl_gravestone_doji, cdl_long_legged_doji, cdl_rickshaw_man, cdl_takuri, cdl_marubozu, cdl_closing_marubozu, cdl_long_line, cdl_short_line, cdl_spinning_top, cdl_high_wave, cdl_belt_hold |
| 2 | cdl_doji_star, cdl_hammer, cdl_hanging_man, cdl_inverted_hammer, cdl_shooting_star, cdl_engulfing, cdl_harami, cdl_harami_cross, cdl_piercing, cdl_dark_cloud_cover, cdl_counterattack, cdl_separating_lines, cdl_on_neck, cdl_in_neck, cdl_thrusting, cdl_homing_pigeon, cdl_matching_low, cdl_kicking, cdl_kicking_by_length |
| 3 | cdl_morning_star, cdl_evening_star, cdl_morning_doji_star, cdl_evening_doji_star, cdl_abandoned_baby, cdl_tristar, cdl_3_white_soldiers, cdl_3_black_crows, cdl_identical_3_crows, cdl_2_crows, cdl_upside_gap_2_crows, cdl_3_inside, cdl_3_outside, cdl_3_stars_in_south, cdl_advance_block, cdl_stalled_pattern, cdl_unique_3_river, cdl_stick_sandwich, cdl_tasuki_gap, cdl_gap_side_side_white, cdl_xside_gap_3_methods, cdl_hikkake |
| 4–5 | cdl_concealing_baby_swallow, cdl_3_line_strike, cdl_rise_fall_3_methods, cdl_mat_hold, cdl_breakaway, cdl_ladder_bottom, cdl_hikkake_mod |
Seven patterns take a penetration argument controlling how far one candle
must close into another: cdl_morning_star, cdl_evening_star,
cdl_morning_doji_star, cdl_evening_doji_star, cdl_abandoned_baby,
cdl_mat_hold (default 0.3, 0.5 for mat hold), and cdl_dark_cloud_cover
(default 0.5). Raising it makes the pattern stricter.
polars_ta.candles
¶
Candlestick pattern recognition — 61 patterns, as pure Polars expressions.
Rewritten for Polars, inspired by TA-Lib¶
The pattern definitions here — which candles must be black or white, how far
a gap must reach, what counts as a "long" body — follow TA-Lib's C
implementations, which are the de-facto reference for these patterns and encode
decades of accumulated convention. Nothing is ported line-by-line: TA-Lib walks
one bar at a time with running trailing sums and mutable state, whereas every
function here compiles to a single vectorized pl.Expr built from shifts and
rolling windows. The output is designed to match TA-Lib's, so you can diff
against talib directly.
Ideas worth keeping from TA-Lib¶
Two of its design choices carried over because they are genuinely good, and
both live in :mod:polars_ta._candle_internal:
- A global settings table instead of magic numbers. "Long body" means
"bigger than 1.0x the average body of the last 10 candles" — a relative
threshold, so a pattern means the same thing on a $3 stock and a $3,000 one,
and adapts as volatility regimes change. Retuning
CANDLE_SETTINGSretunes every pattern coherently. - The average excludes the candle being judged, so a candle never helps set
the threshold it is measured against. See the
_candle_internaldocstring.
What the output means¶
Each function returns an Int32 expression:
| Value | Meaning |
|---|---|
100 |
Bullish occurrence |
-100 |
Bearish occurrence |
0 |
Pattern not present |
null |
Warm-up — not enough history to decide |
The null warm-up is the one deliberate divergence from TA-Lib, which reports
0 for bars it could not evaluate. This library's convention is that warm-up
is null and never faked, so a "no pattern here" is never confused with a "could
not tell" — which matters when these become model features.
Patterns that are inherently one-sided (a hammer is always bullish) return
100/0; patterns that come in both directions (engulfing, harami) return the
signed value.
These are features, not signals
Candlestick patterns are weak, noisy predictors on their own, and most fire far too often to trade unfiltered. They are most useful as conditioning features — combined with trend, volatility, or volume context. Nothing here validates that a pattern has predictive value on your data.
Usage¶
Every function defaults to the conventional column names, so the common case is a bare call:
import polars as pl
from polars_ta import candles
df.with_columns(
candles.cdl_engulfing().alias("engulfing"),
candles.cdl_hammer().alias("hammer"),
candles.cdl_morning_star(penetration=0.3).alias("morning_star"),
)
Custom column names, an expression namespace call, and per-symbol frames all work the way they do everywhere else in the library:
candles.cdl_doji("o", "h", "l", "c")
pl.col("open").ta.cdl_doji()
df.with_columns(candles.cdl_harami().over("symbol"))
ALL_PATTERNS maps every pattern name to its function, for computing the whole
family at once:
df.with_columns(fn().alias(name) for name, fn in candles.ALL_PATTERNS.items())
cdl_doji
¶
cdl_doji(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Doji — open and close virtually equal.
A body smaller than 10% of the recent high-low range. Signals indecision: buyers and sellers finished the bar where they started.
Source code in polars_ta/candles.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
cdl_doji_star
¶
cdl_doji_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Doji Star — a long candle, then a doji gapping away from it.
Bearish (-100) after a long white candle that gaps up, bullish (100)
after a long black candle that gaps down: momentum has stalled.
Source code in polars_ta/candles.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
cdl_dragonfly_doji
¶
cdl_dragonfly_doji(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Dragonfly Doji — doji with a long lower shadow and no upper shadow.
Price sold off hard and recovered entirely by the close.
Source code in polars_ta/candles.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
cdl_gravestone_doji
¶
cdl_gravestone_doji(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Gravestone Doji — doji with a long upper shadow and no lower shadow.
The mirror of the dragonfly: a rally that gave everything back.
Source code in polars_ta/candles.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
cdl_long_legged_doji
¶
cdl_long_legged_doji(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Long Legged Doji — doji with at least one very long shadow.
Wide-ranging indecision: the bar covered a lot of ground and settled flat.
Source code in polars_ta/candles.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
cdl_rickshaw_man
¶
cdl_rickshaw_man(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Rickshaw Man — long-legged doji whose body sits near the range midpoint.
Source code in polars_ta/candles.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
cdl_takuri
¶
cdl_takuri(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Takuri — a dragonfly doji with an exceptionally long lower shadow.
Source code in polars_ta/candles.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
cdl_marubozu
¶
cdl_marubozu(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Marubozu — a long candle with essentially no shadows.
One side controlled the entire bar: the open and close are the extremes. Signed by candle color.
Source code in polars_ta/candles.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
cdl_closing_marubozu
¶
cdl_closing_marubozu(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Closing Marubozu — long candle with no shadow on the closing end.
The close finished at the extreme of the bar; the opening end may have a shadow. Signed by candle color.
Source code in polars_ta/candles.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
cdl_long_line
¶
cdl_long_line(open_: str | Expr = _L" backlink-type="used-by" backlink-anchor="polars_ta.candles.cdl_long_line" optional>_L, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Long Line Candle — a long body with short shadows. Signed by color.
Source code in polars_ta/candles.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
cdl_short_line
¶
cdl_short_line(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Short Line Candle — a short body with short shadows. Signed by color.
Source code in polars_ta/candles.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
cdl_spinning_top
¶
cdl_spinning_top(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Spinning Top — small body with both shadows longer than it.
Indecision, but with more range than a doji. Signed by color.
Source code in polars_ta/candles.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
cdl_high_wave
¶
cdl_high_wave(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
High-Wave Candle — small body with very long shadows on both sides.
Extreme volatility with no resolution. Signed by color.
Source code in polars_ta/candles.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
cdl_belt_hold
¶
cdl_belt_hold(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Belt-hold — a long candle that opens at its own extreme.
Bullish when a long white candle opens at its low, bearish when a long black candle opens at its high.
Source code in polars_ta/candles.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
cdl_hammer
¶
cdl_hammer(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Hammer — small body at the top, long lower shadow, after a decline.
Bullish reversal: sellers pushed price down and were fully rejected. The body must also sit near the prior candle's low, which is what ties it to a downtrend rather than firing anywhere.
Source code in polars_ta/candles.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
cdl_hanging_man
¶
cdl_hanging_man(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Hanging Man — hammer shape, but occurring after an advance.
Same geometry as the hammer; bearish because of where it appears — the body sits near the prior candle's high.
Source code in polars_ta/candles.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
cdl_inverted_hammer
¶
cdl_inverted_hammer(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Inverted Hammer — small body, long upper shadow, gapping down after a fall.
Bullish reversal: an intrabar rally attempt after a gap down.
Source code in polars_ta/candles.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
cdl_shooting_star
¶
cdl_shooting_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Shooting Star — small body, long upper shadow, gapping up after a rally.
Bearish reversal: the mirror of the inverted hammer.
Source code in polars_ta/candles.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |
cdl_engulfing
¶
cdl_engulfing(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Engulfing Pattern — a body that completely swallows the previous one.
Bullish when a white candle engulfs a prior black body, bearish for the reverse. One of the few patterns with no threshold tuning at all: it is pure geometry.
Source code in polars_ta/candles.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
cdl_harami
¶
cdl_harami(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Harami Pattern — a small body contained within the previous long body.
The inverse of engulfing: momentum compressed rather than reversed. Bullish after a long black candle, bearish after a long white one.
Source code in polars_ta/candles.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
cdl_harami_cross
¶
cdl_harami_cross(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Harami Cross — a harami whose second candle is a doji.
Considered a stronger signal than a plain harami: total indecision inside the prior body.
Source code in polars_ta/candles.py
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
cdl_piercing
¶
cdl_piercing(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Piercing Pattern — a white candle closing above the midpoint of a black one.
Bullish reversal: price gapped down, then bought back more than half of the previous day's loss.
Source code in polars_ta/candles.py
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
cdl_dark_cloud_cover
¶
cdl_dark_cloud_cover(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.5) -> Expr
Dark Cloud Cover — a black candle closing well into a prior white body.
The bearish mirror of piercing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the black body must close into the white one, as a
fraction of that body. TA-Lib's default is |
0.5
|
Source code in polars_ta/candles.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
cdl_counterattack
¶
cdl_counterattack(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Counterattack — two long opposite-colored candles closing at the same level.
A gap in the trend direction that is completely erased by the close.
Source code in polars_ta/candles.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
cdl_separating_lines
¶
cdl_separating_lines(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Separating Lines — opposite-colored candles sharing the same open.
A continuation pattern: the counter-trend candle's move is immediately given back from the identical opening price.
Source code in polars_ta/candles.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |
cdl_on_neck
¶
cdl_on_neck(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
On-Neck Pattern — a white candle closing exactly at the prior black low.
Bearish continuation: the bounce stalled precisely at the previous low.
Source code in polars_ta/candles.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |
cdl_in_neck
¶
cdl_in_neck(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
In-Neck Pattern — a white candle closing just barely into the black body.
Bearish continuation, slightly weaker penetration than thrusting.
Source code in polars_ta/candles.py
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | |
cdl_thrusting
¶
cdl_thrusting(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Thrusting Pattern — a white candle closing into but below the black midpoint.
A failed piercing: not enough recovery to flip the bias, so bearish.
Source code in polars_ta/candles.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
cdl_homing_pigeon
¶
cdl_homing_pigeon(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Homing Pigeon — a small black candle inside a prior long black body.
Bullish reversal: selling pressure visibly shrinking.
Source code in polars_ta/candles.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
cdl_matching_low
¶
cdl_matching_low(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Matching Low — two black candles closing at an identical level.
Bullish: a support level that held twice.
Source code in polars_ta/candles.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | |
cdl_kicking
¶
cdl_kicking(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Kicking — two opposite marubozu separated by a gap.
A violent sentiment flip with no overlap between the two candles at all.
Source code in polars_ta/candles.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |
cdl_kicking_by_length
¶
cdl_kicking_by_length(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Kicking by Length — a kicking whose direction follows the longer marubozu.
Identical geometry to cdl_kicking; only
the sign convention differs.
Source code in polars_ta/candles.py
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | |
cdl_morning_star
¶
cdl_morning_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.3) -> Expr
Morning Star — long black, a small gapped-down body, then a strong white.
The classic bullish bottom: capitulation, indecision, then recovery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the third candle must close back into the first
body, as a fraction of it. TA-Lib's default is |
0.3
|
Source code in polars_ta/candles.py
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | |
cdl_evening_star
¶
cdl_evening_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.3) -> Expr
Evening Star — long white, a small gapped-up body, then a strong black.
The bearish mirror of the morning star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the third candle must close back into the first
body, as a fraction of it. TA-Lib's default is |
0.3
|
Source code in polars_ta/candles.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | |
cdl_morning_doji_star
¶
cdl_morning_doji_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.3) -> Expr
Morning Doji Star — a morning star whose middle candle is a doji.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the third candle must close back into the first
body, as a fraction of it. TA-Lib's default is |
0.3
|
Source code in polars_ta/candles.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | |
cdl_evening_doji_star
¶
cdl_evening_doji_star(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.3) -> Expr
Evening Doji Star — an evening star whose middle candle is a doji.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the third candle must close back into the first
body, as a fraction of it. TA-Lib's default is |
0.3
|
Source code in polars_ta/candles.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | |
cdl_abandoned_baby
¶
cdl_abandoned_baby(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.3) -> Expr
Abandoned Baby — a star pattern where the doji gaps away on both sides.
Rare and considered strong: the middle candle shares no price overlap with either neighbour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the third candle must close back into the first
body, as a fraction of it. TA-Lib's default is |
0.3
|
Source code in polars_ta/candles.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | |
cdl_tristar
¶
cdl_tristar(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Tristar Pattern — three consecutive doji, the middle one gapping away.
Total indecision three bars running, with the middle bar detached.
Source code in polars_ta/candles.py
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | |
cdl_3_white_soldiers
¶
cdl_3_white_soldiers(open_: str | Expr = _O, high: str | Expr = _L" backlink-type="used-by" backlink-anchor="polars_ta.candles.cdl_3_white_soldiers" optional>_L, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three Advancing White Soldiers — three long white candles, each higher.
Strong bullish continuation: steady accumulation with short upper shadows and each open inside the previous body.
Source code in polars_ta/candles.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | |
cdl_3_black_crows
¶
cdl_3_black_crows(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three Black Crows — three long black candles, each closing lower.
Strong bearish continuation, each opening inside the prior body.
Source code in polars_ta/candles.py
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | |
cdl_identical_3_crows
¶
cdl_identical_3_crows(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Identical Three Crows — three black candles, each opening at the prior close.
A stricter three-crows: no gaps or overlap, just relentless selling.
Source code in polars_ta/candles.py
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | |
cdl_2_crows
¶
cdl_2_crows(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Two Crows — a gap-up black candle that then closes into the white body.
Bearish reversal: the gap up was completely rejected over two bars.
Source code in polars_ta/candles.py
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | |
cdl_upside_gap_2_crows
¶
cdl_upside_gap_2_crows(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Upside Gap Two Crows — a gap up, then two black candles closing the gap.
Bearish reversal in an uptrend.
Source code in polars_ta/candles.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | |
cdl_3_inside
¶
cdl_3_inside(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three Inside Up/Down — a harami confirmed by a third candle.
The confirmation bar closes beyond the harami, turning a pause into a reversal signal.
Source code in polars_ta/candles.py
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | |
cdl_3_outside
¶
cdl_3_outside(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three Outside Up/Down — an engulfing pattern confirmed by a third candle.
Source code in polars_ta/candles.py
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | |
cdl_3_stars_in_south
¶
cdl_3_stars_in_south(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three Stars In The South — three black candles with shrinking range.
Bullish reversal: selling that visibly runs out of steam, each candle smaller and holding above the previous low.
Source code in polars_ta/candles.py
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 | |
cdl_advance_block
¶
cdl_advance_block(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Advance Block — three white candles whose bodies shrink and shadows grow.
Bearish: an advance that is visibly losing conviction.
Source code in polars_ta/candles.py
1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | |
cdl_stalled_pattern
¶
cdl_stalled_pattern(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Stalled Pattern — three white candles ending in a small body riding the prior.
Bearish: the third advance is tiny and gaps up onto the second body — the rally has stalled.
Source code in polars_ta/candles.py
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | |
cdl_unique_3_river
¶
cdl_unique_3_river(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Unique 3 River — a long black, a harami making a new low, then a small white.
A rare bullish bottom formation.
Source code in polars_ta/candles.py
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | |
cdl_stick_sandwich
¶
cdl_stick_sandwich(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Stick Sandwich — two black candles sandwiching a white one, equal closes.
Bullish: the same close was defended twice.
Source code in polars_ta/candles.py
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 | |
cdl_tasuki_gap
¶
cdl_tasuki_gap(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Tasuki Gap — a gap, a continuation candle, then a partial fill.
A continuation pattern: the counter-candle fails to close the gap.
Source code in polars_ta/candles.py
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 | |
cdl_gap_side_side_white
¶
cdl_gap_side_side_white(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Up/Down-gap side-by-side white lines — two similar whites after a gap.
Continuation in the gap's direction.
Source code in polars_ta/candles.py
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 | |
cdl_xside_gap_3_methods
¶
cdl_xside_gap_3_methods(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Upside/Downside Gap Three Methods — a gap filled by the third candle.
Continuation: two same-colored candles with a gap, then a counter-candle that opens and closes inside both, filling the gap.
Source code in polars_ta/candles.py
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | |
cdl_concealing_baby_swallow
¶
cdl_concealing_baby_swallow(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Concealing Baby Swallow — four blacks, the last engulfing the third.
A rare bullish bottom in a strong downtrend.
Source code in polars_ta/candles.py
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | |
cdl_3_line_strike
¶
cdl_3_line_strike(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Three-Line Strike — three trending candles, then one that engulfs all three.
Counter-intuitively a continuation pattern in TA-Lib's convention: the sign follows the three-candle trend, not the striking candle.
Source code in polars_ta/candles.py
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | |
cdl_rise_fall_3_methods
¶
cdl_rise_fall_3_methods(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Rising/Falling Three Methods — long candle, three pullbacks, long candle.
A continuation pattern: the pullback stays inside the first candle's range and the fifth candle resumes the trend at a new extreme.
Source code in polars_ta/candles.py
1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 | |
cdl_mat_hold
¶
cdl_mat_hold(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C, penetration: float = 0.5) -> Expr
Mat Hold — a bullish five-candle continuation with a gapped-up pullback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
penetration
|
float
|
How far the pullback may retrace into the first body.
TA-Lib's default is |
0.5
|
Source code in polars_ta/candles.py
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | |
cdl_breakaway
¶
cdl_breakaway(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Breakaway — a five-candle gap-and-return that closes back into the gap.
Bullish after a downside gap, bearish after an upside one.
Source code in polars_ta/candles.py
1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | |
cdl_ladder_bottom
¶
cdl_ladder_bottom(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Ladder Bottom — three descending blacks, a shadowed black, then a white.
A bullish bottom reversal.
Source code in polars_ta/candles.py
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 | |
cdl_hikkake
¶
cdl_hikkake(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Hikkake Pattern — an inside bar, a false breakout, then a reversal.
Emits ±100 when the false breakout completes, and ±100 again if the
move is confirmed within the following three bars.
Source code in polars_ta/candles.py
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 | |
cdl_hikkake_mod
¶
cdl_hikkake_mod(open_: str | Expr = _O, high: str | Expr = _H, low: str | Expr = _L, close: str | Expr = _C) -> Expr
Modified Hikkake Pattern — a hikkake with an extra context bar.
Adds a requirement on where the inside bar closed within its own range,
which makes it rarer and, by reputation, more reliable than the plain
cdl_hikkake.
Source code in polars_ta/candles.py
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 | |