TL;DR. A cup and handle is a rounded base between two highs at about the same price (the rims), then a short, shallow pullback from the right rim (the handle), then a close above the handle. The Cup and Handle node finds it, and the inverted cup that breaks down, fires once on the breakout bar, and hands you the breakout level, a measured-move target and a stop. One Sensitivity setting decides how strict the shape must be.
What it measures
- A base that resolves upward. Price falls from a high, rounds out, climbs back to about the same high, pauses briefly, then breaks through. The breakout says the supply at that high has been absorbed.
- Both directions in one node. The cup and handle breaks up; the inverted cup is the same shape upside down and breaks down. The node's breakout reads +1 for a cup and handle and -1 for an inverted cup.
- Once per pattern. The breakout fires on one bar and the pattern ends. Another breakout needs a new right rim.
Formula
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Sensitivity | 5 | 1 to 10 | How strict the shape is. 1 finds only the cleanest cups, 10 the loosest; 5 is the textbook shape. Every setting below moves with it. |
| Longest cup | 120 | 20 to 500 bars | The most bars from the left rim to the breakout, the handle included. |
| Target (% of height) | 100 | 10 to 500 | The target's distance past the breakout level, in percent of the cup's depth. 100 is the classic measured move. |
| Settings | From Sensitivity | From Sensitivity, Custom | Custom unlocks the seven settings below and reads them as you set them. |
| Rims are swings of | 4 bars each side | 1 to 50 | Swing strength of each rim. Step 1: 5, steps 6 to 10: 3. |
| Cup at least (ATR deep) | 2.2 | 0.1 to 50 | The cup's least depth below the lower rim. Step 1: 4.0, step 10: 1.0. |
| Rims within | 0.75 ATR | 0 to 20 | How far apart the two rims may be. Step 1: 0.3, step 10: 1.6. |
| Cup at least (bars long) | 15 | 4 to 500 | The fewest bars from rim to rim. Step 1: 30, step 10: 6. |
| Handle gives back at most | 40% of the cup | 1 to 100 | The deepest the handle may pull back. Step 1: 25%, step 10: 65%. |
| Handle at least | 5 bars | 1 to 200 | The fewest handle bars before a break counts. Step 1: 8, step 10: 2. |
| Breaks by | 0.05 ATR | 0 to 5 | How far past the handle a close must be. Step 1: 0.15, steps 7 to 10: 0. |
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Breakout | Numeric | Always | +1 on a cup and handle's breakout bar, -1 on an inverted cup's, 0 elsewhere. Wire it into a Comparison (greater than 0 for longs, less than 0 for shorts). |
| Cup and handle breakout, Inverted cup breakout | Numeric | On select | 1 on that side's breakout bar, else 0. |
| Stage | Numeric | On select | 0 none, 1 a cup found with a handle still short, 2 armed (a close beyond the level would break out). Positive for a cup and handle, negative for an inverted cup. |
| Breakout level | Numeric | Always | The armed pattern's handle high (or low, for an inverted cup). |
| Pattern high, Pattern low | Numeric | On select | The pattern's range since the left rim. |
| Target, Stop | Numeric | On select | The last breakout's measured move and its handle's far side, held until the next breakout. |
| Bars forming | Numeric | On select | Bars since the left rim. |
How to read it
- Stage 2: a cup is confirmed and its handle is long enough. A close beyond the level is the signal.
- Stage 1: the right rim is confirmed, but the handle has not lasted Handle at least bars yet.
- A level that disappears without a marker: the handle dropped too deep or ran too long, a new swing high formed, or the whole pattern ran longer than its limit.
- Few signals: raise Sensitivity one step at a time and watch the count. Each step loosens every rule together, so the shape stays coherent.
Best in, worst in
Best in markets that have trended and then based for a while, where the old high is a level other traders watch.
Worst in fast, choppy sessions: the rims rarely line up, and a loose step finds small cups that are only noise.
Three setups
1. Cup breakout with a trend filter
Wire Breakout into a Comparison (greater than 0) and AND it with an EMA trend filter (EMA 20 above EMA 50) into a long Entry. Mirror it with less than 0 and EMA 20 below EMA 50 for shorts.
2. Measured-move exits
Set a Bracket Order with its target at the node's Target and its stop at the node's Stop, so every trade's exits come from its own cup.
3. Volume on the break
Require Volume above its average on the breakout bar, as a separate clause, so you can see how many breakouts it removes.
Common mistakes
- Expecting the signal at the right rim. The node waits for the rim to be confirmed and for the handle to form. Buying the rim itself is a different, earlier trade.
- Loosening several rules at once. Move Sensitivity one step, not seven separate settings. If you need one rule different, switch Settings to Custom and change only that one.
- Choosing Sensitivity on the backtest you report. Pick it on one window and check it on another (overfitting in trading).
The Cup and Handle node finds two rims around a rounded cup, a shallow handle, and the close through it, in both directions, once per pattern. Sensitivity sets how strict the whole shape is with one number.