OPEN-SOURCE SCRIPT
Pattern Detector [theUltimator5]

🎯 Overview
The Pattern Detector is a comprehensive technical analysis indicator that automatically identifies and visualizes multiple pattern types on your charts. Built with advanced ZigZag technology and sophisticated pattern recognition algorithms, this tool helps traders spot high-probability trading opportunities across all timeframes and markets.
✨ Key Features
🔍 Multi-Pattern Detection System
📊 Advanced ZigZag Engine
🎨 Visualization
🛠️ Settings & Configuration
Core ZigZag Settings
Pattern Detection Toggles
Display Options
📈 Pattern Types Explained
Harmonic Patterns 🦋
Advanced Fibonacci-based patterns that provide high-probability reversal signals:
Head & Shoulders 👤
Classic three-peak reversal pattern indicating trend exhaustion:
Double Patterns 📊
Powerful reversal patterns with extreme validation:
Wedge Patterns 📐
Continuation/reversal patterns with converging trend lines:
🎯 Trading Applications
Entry Signals
Risk Management
Multi-Timeframe Analysis
⚙️ Optimal Settings
For Day Trading (1m-15m charts)
For Swing Trading (1H-4H charts)
For Position Trading (Daily+ charts)
🔧 Technical Specifications
📚 How to Use
Perfect for both novice and experienced traders seeking systematic pattern recognition with visualization and entry/exit signals.
The Pattern Detector is a comprehensive technical analysis indicator that automatically identifies and visualizes multiple pattern types on your charts. Built with advanced ZigZag technology and sophisticated pattern recognition algorithms, this tool helps traders spot high-probability trading opportunities across all timeframes and markets.
✨ Key Features
🔍 Multi-Pattern Detection System
- Harmonic Patterns: Butterfly, Gartley, Bat, and Crab patterns with precise Fibonacci ratios
- Classic Reversal Patterns: Head & Shoulders and Inverse Head & Shoulders
- Double Patterns: Double Tops and Double Bottoms with extreme validation
- Wedge Patterns: Rising and Falling Wedges with volume confirmation
📊 Advanced ZigZag Engine
- Customizable sensitivity (5-50 levels)
- Depth multiplier for multi-timeframe analysis
- Real-time pivot detection with noise filtering
- Option to display ZigZag lines only for pure price action analysis
🎨 Visualization
- Clean pattern lines with distinct color coding
- Point labeling system (X, A, B, C, D for harmonics / LS, H, RS for H&S)
- Pattern name displays with bullish/bearish direction
- Price target projections with arrow indicators
- Subtle pattern fills for enhanced visibility
🛠️ Settings & Configuration
Core ZigZag Settings
- ZigZag Sensitivity (5-50): Controls pattern detection sensitivity. Lower values detect more patterns but may include noise. Higher values focus on major swings only.
- ZigZag Depth Multiplier (1-5): Multiplies sensitivity for deeper analysis. Level 1 = most responsive, Level 5 = major swings only.
Pattern Detection Toggles
- Show ZigZag Lines Only: Displays pure ZigZag without pattern detection for price structure analysis
- Detect Harmonic Patterns: Enable/disable Fibonacci-based harmonic pattern detection
- Detect Head & Shoulders: Toggle classic reversal pattern identification
- Detect Double Tops/Bottoms: Enable double pattern detection with extreme validation
- Detect Wedge Patterns: Toggle wedge pattern detection with volume confirmation
Display Options
- Show Pattern Names: Display pattern names directly on chart (e.g., "Butterfly (Bullish)")
- Show Point Labels: Add lettered labels at key pattern points for structure identification
- Project Harmonic Targets: Show projected completion points for incomplete harmonic patterns
📈 Pattern Types Explained
Harmonic Patterns 🦋
Advanced Fibonacci-based patterns that provide high-probability reversal signals:
- Butterfly: AB=0.786 XA, BC=0.382-0.886 AB, CD=1.618-2.24 BC
- Gartley: AB=0.618 XA, BC=0.382-0.886 AB, CD=1.272-1.618 BC
- Bat: AB=0.382-0.50 XA, BC=0.382-0.886 AB, CD=1.618-2.24 BC
- Crab: AB=0.382-0.618 XA, BC=0.382-0.886 AB, CD=2.24-3.618 BC
Head & Shoulders 👤
Classic three-peak reversal pattern indicating trend exhaustion:
- Standard H&S: Bearish reversal at tops
- Inverse H&S: Bullish reversal at bottoms
- Automatic neckline validation and price target calculation
Double Patterns 📊
Powerful reversal patterns with extreme validation:
- Double Top: Two similar highs with valley between (bearish)
- Double Bottom: Two similar lows with peak between (bullish)
- Includes lookback period validation to ensure patterns are significant extremes
Wedge Patterns 📐
Continuation/reversal patterns with converging trend lines:
- Rising Wedge: Converging upward slopes (typically bearish)
- Falling Wedge: Converging downward slopes (typically bullish)
- Volume confirmation required for increased accuracy
🎯 Trading Applications
Entry Signals
- Harmonic Patterns: Enter at point D completion with targets at point A
- H&S Patterns: Enter on neckline break with calculated targets
- Double Patterns: Enter on support/resistance break with measured moves
- Wedge Patterns: Enter on breakout direction with volume confirmation
Risk Management
- Use pattern structure for logical stop placement
- Pattern invalidation levels provide clear exit rules
- Multiple pattern confirmation increases probability
Multi-Timeframe Analysis
- Higher ZigZag depth for longer-term patterns
- Lower sensitivity for short-term trading patterns
- Combine with other timeframes for confluence
⚙️ Optimal Settings
For Day Trading (1m-15m charts)
- ZigZag Sensitivity: 5-9
- Depth Multiplier: 1-2
- Enable all pattern types for maximum opportunities
For Swing Trading (1H-4H charts)
- ZigZag Sensitivity: 9-15
- Depth Multiplier: 2-3
- Focus on harmonic and H&S patterns
For Position Trading (Daily+ charts)
- ZigZag Sensitivity: 15-25
- Depth Multiplier: 3-5
- Emphasize major harmonic and double patterns
🔧 Technical Specifications
- Maximum Lookback: 5000 bars for comprehensive analysis
- Pattern Overlap Prevention: Intelligent filtering prevents duplicate patterns
- Performance Optimized: Efficient algorithms for real-time detection
- Volume Integration: Advanced volume analysis for wedge confirmation
- Fibonacci Precision: 10% tolerance for harmonic ratio validation
📚 How to Use
- Add to Chart: Apply indicator to any timeframe/market
- Configure Settings: Adjust sensitivity based on trading style
- Enable Patterns: Toggle desired pattern types
- Analyze Results: Look for completed patterns with clear structure
- Plan Trades: Use price targets and pattern invalidation for trade management
Perfect for both novice and experienced traders seeking systematic pattern recognition with visualization and entry/exit signals.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.