Skip to content
StatePath
Tool Atlasmarket.chart_patterns

Tool

Chart Patterns

market.chart_patterns

MarketStructure

Inputs

pivotsEvent list

An optional stream of pre-computed swing pivots (highs and lows) for the detector to build patterns from. Wire in your own zigzag or swing source to control exactly which turning points count; leave it unconnected and the tool derives pivots internally from zigzag_depth and pivot_sensitivity.

Outputs

Bundle (untagged)

A bundle of detected chart patterns. Each match carries its family, the bars it spans, its key boundaries (neckline, rails, support/resistance), whether and where it broke out, and a projected price target sized by measure_factor_mode. Tap the bundle to gate entries on a specific pattern or to drive targets and stops.

Chart Patterns scans price for the classic geometric formations technical traders watch — double tops, head & shoulders, triangles, channels, wedges, flags, the cup and handle, and more. For each pattern it finds, it tells you the shape, where the breakout line sits, and a projected price target.

Chart Patterns overview diagramcp.neckline

How it works

It reduces price to a zigzag of swing pivots (using zigzag_depth and pivot_sensitivity, or pivots you supply), then tests the recent pivot sequence against the geometry of every family you enable — equal highs/lows, converging or parallel trendlines, symmetry, and duration. A match is confirmed when price clears the pattern's boundary by breakout_threshold (in percent or ATR), optionally with a volume surge, and the target is projected from the pattern height by measure_factor_mode.

Modes

Families options

Double top (M)double_top

Two peaks at roughly the same high with a valley between — a bearish reversal that confirms when price breaks the neckline drawn under the middle trough.

Double top (M) diagramcp.necklinecp.resistance

When to use: Spotting a topping market: two failed pushes to the same ceiling, then a break of the swing low between them.

Double bottom (W)double_bottom

Two troughs at roughly the same low with a peak between — a bullish reversal that confirms when price breaks the neckline drawn over the middle peak.

Double bottom (W) diagramcp.necklinecp.support

When to use: Spotting a bottoming market: two failed pushes to the same floor, then a break of the swing high between them.

Rectanglerectangle

Price oscillates between a flat support floor and a flat resistance ceiling, building a horizontal range that resolves with a break of either edge.

Rectangle diagramcp.resistancecp.support

When to use: Range / consolidation trading, or waiting for the range to break to take the move that follows.

Head & shoulders tophead_shoulders_top

A left shoulder, a higher head, then a lower right shoulder, all sitting on a neckline — the classic bearish reversal, confirmed on a neckline break.

Head & shoulders top diagramcp.neckline

When to use: Calling the end of an uptrend; the right-shoulder failure plus neckline break is the entry.

Head & shoulders bottomhead_shoulders_bottom

An inverse head and shoulders — left shoulder, deeper head, higher right shoulder under a neckline — a bullish reversal confirmed when price breaks up through the neckline.

Head & shoulders bottom diagramcp.neckline

When to use: Calling the end of a downtrend; the right-shoulder higher low plus neckline break is the entry.

Triple toptriple_top

Three peaks at roughly the same high separated by two troughs — a stronger bearish reversal than a double top, confirmed on a break below the shared support.

Triple top diagramcp.resistancecp.neckline

When to use: When price has failed three times at the same ceiling and you want the downside break.

Triple bottomtriple_bottom

Three troughs at roughly the same low separated by two peaks — a stronger bullish reversal than a double bottom, confirmed on a break above the shared resistance.

Triple bottom diagramcp.supportcp.neckline

When to use: When price has held three times at the same floor and you want the upside break.

V-spike topv_spike_top

A sharp, near-vertical rally that tops in a single spike and reverses just as fast — a fast bearish reversal with no rounding or retest.

V-spike top diagramcp.spike

When to use: Catching a blow-off top: a parabolic push that snaps back hard the same or next bar.

V-spike bottomv_spike_bottom

A sharp, near-vertical sell-off that bottoms in a single spike and reverses just as fast — a fast bullish reversal with no rounding or retest.

V-spike bottom diagramcp.spike

When to use: Catching a capitulation low: a panic flush that snaps back up the same or next bar.

Bump and runbump_run

A gentle lead-in trend (the lead-in line) is followed by a steep, overextended 'bump', then price breaks back below the lead-in trendline and runs the other way.

Bump and run diagramcp.leadin

When to use: Spotting an unsustainable acceleration that gives back the excess once the lead-in line breaks.

Ascending triangletriangle_ascending

A flat resistance ceiling with a rising support line of higher lows — usually a bullish continuation that resolves with a break above the ceiling.

Ascending triangle diagramcp.resistance

When to use: Continuation longs: higher lows pressing into a fixed ceiling that eventually gives way.

Descending triangletriangle_descending

A flat support floor with a falling resistance line of lower highs — usually a bearish continuation that resolves with a break below the floor.

Descending triangle diagramcp.support

When to use: Continuation shorts: lower highs pressing into a fixed floor that eventually breaks.

Symmetrical triangletriangle_symmetrical

Lower highs and higher lows converge into an apex — a neutral coiling pattern that breaks in the direction of the eventual escape, often the prior trend.

Symmetrical triangle diagramcp.apex

When to use: Volatility-squeeze continuation: trade the break of whichever converging line gives way first.

Ascending channelchannel_ascending

Price climbs between two parallel up-sloping lines — a rising channel; trend continuation while it holds, reversal warning if the lower rail breaks.

Ascending channel diagramcp.upper_railcp.lower_rail

When to use: Trading a clean uptrend: buy the lower rail, watch for a break of it as the trend-change tell.

Descending channelchannel_descending

Price falls between two parallel down-sloping lines — a falling channel; trend continuation while it holds, reversal warning if the upper rail breaks.

Descending channel diagramcp.upper_railcp.lower_rail

When to use: Trading a clean downtrend: sell the upper rail, watch for a break of it as the trend-change tell.

Horizontal channelchannel_horizontal

Price ranges sideways between two flat parallel rails — a horizontal channel that trades like a rectangle until one rail breaks.

Horizontal channel diagramcp.upper_railcp.lower_rail

When to use: Sideways markets: fade the rails or wait for the rail break that starts the next trend.

Rising wedgewedge_rising

Both rails slope up but converge, with the lower rail steeper — a tiring rally that usually resolves bearish on a break of the lower line.

Rising wedge diagramcp.upper_railcp.lower_rail

When to use: Spotting an exhausting uptrend: a wedge that narrows upward and tends to break down.

Falling wedgewedge_falling

Both rails slope down but converge, with the upper rail steeper — a tiring sell-off that usually resolves bullish on a break of the upper line.

Falling wedge diagramcp.upper_railcp.lower_rail

When to use: Spotting an exhausting downtrend: a wedge that narrows downward and tends to break up.

Broadening topbroadening_top

A megaphone of higher highs and lower lows widening over time, formed near a high — rising volatility and instability that often resolves bearish.

Broadening top diagram

When to use: Reading a choppy, expanding top where swings get wider instead of tighter.

Broadening bottombroadening_bottom

A megaphone of higher highs and lower lows widening over time, formed near a low — expanding volatility that often resolves bullish out of the base.

Broadening bottom diagram

When to use: Reading a choppy, expanding bottom where swings get wider before a resolution higher.

Bull flagflag_bull

A steep rally (the flagpole) followed by a small down-sloping consolidation channel — a bullish continuation that breaks up out of the flag.

Bull flag diagramcp.flag_topcp.flag_bottom

When to use: Continuation longs after a strong impulse: buy the break out of the pullback channel.

Bear flagflag_bear

A steep drop (the flagpole) followed by a small up-sloping consolidation channel — a bearish continuation that breaks down out of the flag.

Bear flag diagramcp.flag_topcp.flag_bottom

When to use: Continuation shorts after a strong impulse down: sell the break out of the bounce channel.

Pennantpennant

A sharp move followed by a small symmetrical-triangle pause that converges to a point — a brief continuation that breaks in the direction of the prior impulse.

Pennant diagramcp.apex

When to use: Continuation after a fast move: trade the break of the little coil in the trend's direction.

Rounding toprounding_top

Price arcs over in a slow, smooth dome — a gradual bearish reversal where the uptrend rolls over into a downtrend without a sharp pivot.

Rounding top diagram

When to use: Reading a slow distribution top where momentum quietly fades and rolls down.

Rounding bottomrounding_bottom

Price arcs through a slow, smooth saucer — a gradual bullish reversal where the downtrend rounds out into an uptrend without a sharp pivot.

Rounding bottom diagram

When to use: Reading a slow accumulation base where selling quietly dries up and turns up.

Cup and handlecup_handle

A rounded saucer (the cup) followed by a small downward drift (the handle) just under the rim — a bullish continuation that breaks out above the rim.

Cup and handle diagramcp.rim

When to use: Continuation longs from a long base: buy the breakout over the rim after the handle pulls back.

Inverted cup and handlecup_handle_inverted

A rounded dome (the inverted cup) followed by a small upward drift (the handle) just above the rim — a bearish continuation that breaks down below the rim.

Inverted cup and handle diagramcp.rim

When to use: Continuation shorts from a topping dome: sell the breakdown under the rim after the handle bounces.

Diamond topdiamond_top

Swings first broaden then contract, tracing a diamond near a high — a bearish reversal that confirms on a break of the lower converging line.

Diamond top diagram

When to use: Reading a top that flares out into a megaphone then coils back in before rolling over.

Diamond bottomdiamond_bottom

Swings first broaden then contract, tracing a diamond near a low — a bullish reversal that confirms on a break of the upper converging line.

Diamond bottom diagram

When to use: Reading a base that flares out into a megaphone then coils back in before turning up.

Measured move upmeasured_move_bull

Two roughly equal up-legs joined by a corrective pullback — the first leg projects the size of the second, so the move 'measures' its own target.

Measured move up diagramcp.leg1_topcp.target

When to use: Projecting an upside target: the AB leg up, a BC pullback, then a CD leg that mirrors AB.

Measured move downmeasured_move_bear

Two roughly equal down-legs joined by a corrective bounce — the first leg projects the size of the second, so the move 'measures' its own downside target.

Measured move down diagramcp.leg1_bottomcp.target

When to use: Projecting a downside target: the AB leg down, a BC bounce, then a CD leg that mirrors AB.

Breakout mode options

Percent breakoutpercent

A break counts only once price clears the pattern boundary by breakout_threshold expressed as a percent of price — a scale-free filter that behaves the same on a $1 stock and a $2,000 index.

Percent breakout diagram

When to use: The portable default: when you want the same breakout buffer to mean the same thing across symbols of very different price.

ATR breakoutatr

A break counts only once price clears the pattern boundary by breakout_threshold multiples of ATR — the buffer auto-widens in volatile conditions and tightens in calm ones.

ATR breakout diagram

When to use: When you want the breakout filter to adapt to current volatility instead of a fixed percent, so noisy markets need a bigger push to confirm.

Measure factor mode options

Bulkowski (partial)bulkowski_p

The projected target uses Bulkowski's statistically measured fraction of the pattern height — typically less than the full height, because most patterns historically fall short of the textbook 1:1 projection.

Bulkowski (partial) diagramcp.pattern_highcp.breakoutcp.target_partialcp.full_height

When to use: The realistic default: when you want price targets sized to how far these patterns actually tend to run, not the ideal full measure.

Full heightfull_height

The projected target uses the entire pattern height measured 1:1 from the breakout point — the classic textbook objective, which is more ambitious than the Bulkowski partial.

Full height diagramcp.pattern_highcp.breakoutcp.target_full

When to use: When you want the traditional full-height target, accepting that price reaches it less often than the partial measure.

Configuration

familiesmulti_enum

Which chart-pattern families the detector scans for. Tick on every pattern you care about — 31 are available, from reversals (double top/bottom, head & shoulders, triple top/bottom) through triangles, channels, wedges, flags, and the cup and handle. Each toggled family contributes its own matches to the output bundle.

Choices:double_topdouble_bottomrectanglehead_shoulders_tophead_shoulders_bottomtriple_toptriple_bottomv_spike_topv_spike_bottombump_runtriangle_ascendingtriangle_descendingtriangle_symmetricalchannel_ascendingchannel_descendingchannel_horizontalwedge_risingwedge_fallingbroadening_topbroadening_bottomflag_bullflag_bearpennantrounding_toprounding_bottomcup_handlecup_handle_inverteddiamond_topdiamond_bottommeasured_move_bullmeasured_move_bear
zigzag_depthscalar

The minimum swing depth (in bars) the underlying zigzag must travel before it plants a new pivot. Larger values keep only the bigger swings, so patterns are built from major turns and small wiggles are ignored; smaller values pick up finer structure but admit more noise.

pivot_sensitivityscalar

How readily a local high or low is accepted as a pattern pivot. Higher sensitivity registers more turning points (more candidate patterns, more false positives); lower sensitivity demands cleaner, more pronounced swings before counting a pivot.

equality_tolerance_pctscalar

How close two peaks (or two troughs) must be in price, as a percent, to count as 'equal' — the test that lets a double top, triple top, or rectangle qualify. Larger tolerance accepts rougher matches; tighter tolerance demands near-identical highs or lows.

trendline_min_touchesscalar

The minimum number of pivots a trendline must touch before it is treated as a valid pattern boundary (a triangle, channel, or wedge rail). More touches mean a better-confirmed line but fewer patterns; the usual floor is 2-3 touches per line.

trendline_slope_tolerancescalar

How much the slope of a line is allowed to deviate and still count as 'flat' or 'parallel' — this decides whether a near-flat top is a rectangle vs an ascending triangle, or whether two rails are parallel enough to be a channel. Larger tolerance is more forgiving of imperfect geometry.

symmetry_tolerancescalar

How balanced the two halves of a symmetric pattern must be — left vs right shoulder height in head & shoulders, or the two converging sides of a symmetrical triangle or diamond. Larger tolerance accepts lopsided shapes; tighter tolerance demands clean symmetry.

min_duration_barsscalar

The fewest bars a pattern may span and still qualify. Raising it filters out tiny, fast formations that are mostly noise; lowering it lets short patterns through. Sets the floor of the size window together with max_duration_bars.

max_duration_barsscalar

The most bars a pattern may span and still qualify. Caps how stretched-out a formation can be before the detector stops treating it as one pattern; should be comfortably larger than min_duration_bars.

breakout_modeenum

Which units breakout_threshold is measured in: 'percent' uses a percent of price (scale-free across symbols), 'atr' uses multiples of ATR (adapts to current volatility).

Choices:percentatr
breakout_thresholdscalar

How far price must clear the pattern boundary before the break is confirmed. Its units depend on breakout_mode: a percent of price in 'percent' mode, or a multiple of ATR in 'atr' mode. Larger values demand a more decisive break and cut false breakouts; smaller values confirm sooner.

volume_confirmation_ratioscalar

How much heavier breakout volume must be than the pattern's average for the break to count as volume-confirmed — e.g. 1.5 means 50% above average. Set it to require a volume surge on the break; lower it (or 1.0) to ignore volume.

retest_window_barsscalar

How many bars after a breakout the detector keeps watching for a retest of the broken boundary (the boundary flipping from resistance to support, or vice versa). A wider window catches slower retests; 0 disables retest tracking.

measure_factor_modeenum

How the projected price target is sized from the pattern height: 'bulkowski_p' uses Bulkowski's statistically measured partial fraction (realistic), 'full_height' projects the entire height 1:1 (the textbook objective).

Choices:bulkowski_pfull_height

Connects to

Reads from
Feeds into

Examples

  • Reversal signal: enable head_shoulders_top and gate short entries to bars where a confirmed neckline break prints.
  • Continuation filter: enable flag_bull and triangle_ascending and only take longs when one of them breaks out with volume_confirmation_ratio met.
  • Target driver: read the projected target off a detected double_bottom (sized by measure_factor_mode) to place your take-profit.

Common mistakes

  • Enabling all 31 families at once on a fast timeframe — you drown in overlapping, low-quality matches; pick the few patterns your strategy actually trades.
  • Setting breakout_threshold too small, so every minor poke through a boundary counts as a breakout and you get whipsawed by fake-outs.
  • Expecting the full-height target to be hit reliably — most patterns fall short, which is exactly why the Bulkowski partial measure exists.

See also