OPEN-SOURCE SCRIPT

Cup with Handle Pattern

97
Cup with Handle Pattern Indicator – Description
This Cup with Handle Pattern Indicator is designed to visually identify one of the most powerful bullish continuation patterns in technical analysis — the Cup with Handle.

🔍 What It Detects
The indicator scans for the classic "U-shaped" cup formation followed by a slight downward drift (the handle), which often precedes a breakout.

Once a valid pattern is detected, it plots a green triangle below the price bar at the point of breakout — where the price crosses above recent highs after consolidation.

⚙️ Key Features
Customizable Duration: The cup length can be adjusted (default is 150 bars), allowing flexibility based on the timeframe and asset.

Automatic Breakout Detection: The indicator uses a combination of relative highs, lows, and ATR (Average True Range) to ensure valid setups.

No repainting: Signals are plotted only after confirmation, making this suitable for live trading or backtesting.

🛠️ How It Works
Left Cup High: Detected based on historical highs before the low.

Cup Low: The lowest point within the cup duration.

Right Cup High: A recent high before breakout.

Breakout Point: Triggered when price crosses above the 30-bar high after the handle formation.

Validity Checks: Ensures the structure has a proper depth, symmetry, and volatility conditions using ATR.

📊 Visual Elements
Green Triangle Up: Plotted below bar at the breakout.

Blue Line: Closing price.

✅ Ideal For:
Swing traders and position traders looking for high-probability breakout entries.

Chart analysts who want to automate the detection of classic base-building patterns.

Educational and training purposes for pattern recognition.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.