# Cup-with-Handle Base

Cup-with-Handle Base is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Detects William O'Neil's cup-with-handle base from confirmed swings: a 12-35% U-shaped cup after a 30% prior advance, a right side back near the left-side high, and a shallow handle in the upper half of the base. The buy point sits just above the handle high, breakouts need 1.4x average volume, and a buy zone, 7% stop and 20-25% profit zone then track the trade.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Feb 25, 2026.
- Access: free.
- Concepts: [cup-with-handle base](https://www.luxalgo.com/library/concept/cup-with-handle-base/) (primary), [cup & handle](https://www.luxalgo.com/library/concept/cup-and-handle/)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=yrx1l2pw4uvmpzh7iwa38l80
- Page: https://www.luxalgo.com/library/indicator/cup-with-handle-base/

The **Cup-with-Handle Base** is a systematic technical analysis tool that identifies a well-known consolidation pattern associated with bullish trend continuation. By mapping the formation of a U-shaped price structure followed by a secondary, shallower pullback, the indicator helps traders detect potential entry opportunities as a security prepares for a new move. The tool automatically marks critical price levels, including the breakout pivot and target zones, helping to remove subjectivity from the pattern recognition process. It is designed for traders who follow momentum strategies and seek to capture breakouts from historical price bases.

## How to Trade the Cup-with-Handle Base?

Trading this indicator involves monitoring the chart for the completion of a base. First, look for a rounded, U-shaped correction following an established prior uptrend. The indicator draws this structure on the chart automatically, confirming the pattern once the price recovers to the left side of the cup. Once the cup is established, the indicator monitors the handle phase. A healthy handle should be shallow, representing a brief consolidation where weak holders are shaken out before the trend resumes.

When the price pushes through the identified pivot point above the handle, the indicator flags a breakout. Ideally, this move should be accompanied by a surge in volume, which confirms that institutional buyers are participating in the new leg of the trend. Use the provided dashboard to check the status of the pattern, the buy point and volume metrics; after a confirmed breakout, the buy zone, stop and profit zone are drawn on the chart. When entering, keep in mind that a valid breakout occurs on a decisive close above the pivot. If the handle structure becomes too deep or stays in the lower half of the cup, the pattern is likely invalid, suggesting caution before attempting an entry.

## Cup-with-Handle Base Settings

### Cup
* **Swing Length**: Defines the bars required to validate a swing high, used to identify the start and end points of the cup.
* **Cup Length (bars)**: Sets the minimum and maximum range for the base to ensure it reflects a meaningful consolidation.
* **Cup Depth (%)**: Configures the minimum and maximum allowed correction percentage from the left high to the cup low.
* **Right-side Recovery (%)**: Determines how much of the cup depth the price must recover before a handle is allowed to form.
* **Minimum Bottom Dwell (%)**: Tests the shape of the cup by verifying how much time the price spends in the lower third of the structure.

### Handle
* **Handle Length (bars)**: Sets the timeframe constraints for the handle formation.
* **Handle Depth (%)**: Defines the allowable pullback depth for the handle to prevent it from becoming too loose.
* **Handle In Upper Half**: An option to invalidate the pattern if the handle forms too deep, which is often considered a structural defect.
* **Reject Up-wedging Handles**: Filters out handles that rise in an erratic wedge-like manner, which may not effectively shake out weak positions.

### Prior Uptrend
* **Prior Uptrend Filter**: Enables the requirement that a significant upward move must precede the base formation.
* **Uptrend Window (bars)**: The length of the lookback period used to determine if the trend met the gain requirement.

### Breakout
* **Pivot Margin (%)**: Adds a buffer above the handle high for the entry trigger.
* **Breakout Volume Confirmation**: Ensures the breakout occurs with a significant spike in volume relative to the moving average.

### Trade Levels
* **Fixed Stop**: Sets an automatic stop-loss percentage below the entry point to manage risk.
* **Profit Zone (%)**: Defines the target range for potential profit-taking.

## Frequently Asked Questions

### How does the indicator identify a valid cup shape?
The indicator uses a U-shape test, which calculates the percentage of time the price remains in the bottom third of the total cup range. This ensures that the consolidation is rounded rather than a sharp or erratic decline, which is essential for a classic base.

### Why is the handle volume dry-up feature important?
A volume dry-up in the handle suggests that sellers are exhausted, which is a positive sign before a breakout. When volume decreases as the price forms the handle, it indicates that few are willing to sell at these levels, potentially paving the way for easier upward movement.

### What should I do if a base is labeled as invalidated?
An invalidated label indicates that the pattern failed one of the pre-set technical criteria, such as the handle being too deep or the price extending beyond the buy zone without a breakout. You should avoid taking an entry based on an invalidated pattern as it no longer reflects the required structural integrity.

## Related indicators

- [Half Cup](https://www.luxalgo.com/library/indicator/half-cup/) (Cup & Handle): markdown at https://www.luxalgo.com/library/indicator/half-cup.md
- [Ascending Base](https://www.luxalgo.com/library/indicator/ascending-base/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/ascending-base.md
- [O'Neil Base Analysis](https://www.luxalgo.com/library/indicator/oneil-base-analysis/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/oneil-base-analysis.md
- [Double-bottom Base](https://www.luxalgo.com/library/indicator/double-bottom-base/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/double-bottom-base.md
- [Flat Base](https://www.luxalgo.com/library/indicator/flat-base/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/flat-base.md
- [IPO Base](https://www.luxalgo.com/library/indicator/ipo-base/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/ipo-base.md
- [Gap Fill Breakouts](https://www.luxalgo.com/library/indicator/gap-fill-breakouts/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/gap-fill-breakouts.md
- [On-neck / In-neck / Thrusting](https://www.luxalgo.com/library/indicator/on-neck-in-neck-thrusting/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/on-neck-in-neck-thrusting.md

---

Source: https://www.luxalgo.com/library/indicator/cup-with-handle-base/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
