25 — Structural Analysis

Cup & Handle#

BullishHeuristic1 min read
◆ The PatternA rounded bottom with a brief consolidation — then breakout

The Cup & Handle, popularized by William O'Neil, combines a rounded bottom (the cup) with a brief downward drift or consolidation (the handle) before breaking out to new highs. The cup should be a smooth U-shape, not a sharp V.

Target = Breakout + Depth of cup
The handle should retrace no more than 1/3 of the cup depth. Handle pullbacks of 8-12% are ideal (O'Neil guidelines).
// Cup & Handle — anatomy and target
Key insight: The handle represents the last group of sellers getting shaken out before the breakout. Its brevity and shallow depth signal strong underlying demand.
Pattern bridge: A U-shaped base then a small consolidation — the shape of cosine annealing with a brief plateau before the final push.
Worked example

A 41-day cup from a rim of 110 down to 90 and back: 20 deep. The handle dips to 105, a quarter of the cup’s depth — under the usual one-third limit. Day 50 closes at 112, above the rim; the target is 110 + 20 = 130.

The example data

A U from 110 (day 0) down to 90 (day 20) and back to 110 (day 40), then a handle down to 105 (day 47) and a close of 112 on day 50, as daily closes; high and low are half a point either side of each bar.

Where it misleads
  • O’Neil’s version has conditions this code leaves out — a prior uptrend, the cup’s length, volume drying up in the handle — and they change which cups qualify.
  • A deep handle, or one that falls below the cup’s midpoint, usually means the base has failed.
  • Like every measured move, the target is a rough guide.
In code
c = df['close']
cup = c.iloc[:41]
rim, bottom = min(cup.iloc[0], cup.iloc[-1]), cup.min()
depth = rim - bottom
handle = c.iloc[41:-1]
shallow = rim - handle.min() < depth / 3              # handle retraces under a third of the cup
breakout = c.iloc[-1] > rim
target = rim + depth
Python, in your browser — edit the code and run it again

Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns open, high, low and close for the data above.

Sources
  • How to Make Money in Stocks, W. J. O’Neil, McGraw-Hill, 1988
  • Encyclopedia of Chart Patterns (2nd ed.), T. N. Bulkowski, Wiley, 2005 — success and failure rates from large counts of patterns

Last reviewed October 2026 · How this site checks its content · Report a mistake

Linked from 1
← Previous
Gaps
Open in the full reader, with the topic sidebar