OPEN-SOURCE SCRIPT
Harmonic Patterns + Fib [CRT Trader]

Overview
The Harmonic Patterns Fibonacci indicator is an advanced technical analysis tool designed to automatically detect and visualize Fibonacci-based harmonic patterns on financial charts. This indicator helps traders identify high-probability reversal zones and potential entry/exit points based on precise mathematical relationships.
Supported Patterns
5-Point Patterns (X-A-B-C-D Structure)
Gartley Pattern: The most common harmonic pattern with reliable reversal signals
AB/XA = 0.618, BC/AB = 0.618, CD/BC = 1.272, AD/XA = 0.786
Butterfly Pattern: Strong reversal pattern indicating potential trend changes
AB/XA = 0.786, BC/AB = 0.618, CD/BC = 1.618, AD/XA = 1.270
Bat Pattern: Medium-term reversal pattern with high accuracy
AB/XA = 0.382, BC/AB = 0.886, CD/BC = 1.618, AD/XA = 0.886
Crab Pattern: Aggressive reversal pattern with extended D point
AB/XA = 0.618, BC/AB = 0.886, CD/BC = 2.240, AD/XA = 1.618
Shark Pattern: Trend continuation or reversal pattern
AB/XA = 0.618, BC/AB = 1.130, CD/BC = 1.618, AD/XA = 0.886
4-Point Pattern (A-B-C-D Structure)
ABCD Pattern: Basic harmonic structure forming the foundation of all patterns
BC/AB = 0.382-0.886, CD/BC = 1.130-2.618
Key Features
Fibonacci Validation
Performance Optimization
Visual Elements
Customizable Settings
Trading Applications
Entry Signals
Market Analysis
Strategy Integration
How to Use
Important Notes
Technical Requirements
This indicator is suitable for all experience levels, from beginners learning harmonic patterns to advanced traders seeking automated pattern recognition. The combination of mathematical precision and visual clarity makes it an essential tool for harmonic trading strategies.
The Harmonic Patterns Fibonacci indicator is an advanced technical analysis tool designed to automatically detect and visualize Fibonacci-based harmonic patterns on financial charts. This indicator helps traders identify high-probability reversal zones and potential entry/exit points based on precise mathematical relationships.
Supported Patterns
5-Point Patterns (X-A-B-C-D Structure)
Gartley Pattern: The most common harmonic pattern with reliable reversal signals
AB/XA = 0.618, BC/AB = 0.618, CD/BC = 1.272, AD/XA = 0.786
Butterfly Pattern: Strong reversal pattern indicating potential trend changes
AB/XA = 0.786, BC/AB = 0.618, CD/BC = 1.618, AD/XA = 1.270
Bat Pattern: Medium-term reversal pattern with high accuracy
AB/XA = 0.382, BC/AB = 0.886, CD/BC = 1.618, AD/XA = 0.886
Crab Pattern: Aggressive reversal pattern with extended D point
AB/XA = 0.618, BC/AB = 0.886, CD/BC = 2.240, AD/XA = 1.618
Shark Pattern: Trend continuation or reversal pattern
AB/XA = 0.618, BC/AB = 1.130, CD/BC = 1.618, AD/XA = 0.886
4-Point Pattern (A-B-C-D Structure)
ABCD Pattern: Basic harmonic structure forming the foundation of all patterns
BC/AB = 0.382-0.886, CD/BC = 1.130-2.618
Key Features
Fibonacci Validation
- Each pattern is validated against precise Fibonacci ratios with customizable tolerance
- Mathematical accuracy ensures reliable pattern recognition
- Eliminates false signals through strict ratio requirements
Performance Optimization
- Pivot Detection: Automatically identifies significant highs and lows
- Scan Frequency Control: Adjustable scanning intervals to optimize performance
- Early Exit Algorithms: Efficient computation to reduce processing load
- Pattern Limit: Control maximum number of patterns displayed
Visual Elements
- Pattern Lines: Clear visualization of pattern structure with colored lines
- Fill Areas: Highlighted zones between pattern legs
- Point Labels: X, A, B, C, D markers for easy identification
- Fibonacci Levels: Optional Fibonacci retracement/extension levels
- Bullish/Bearish Colors: Green for bullish, red for bearish patterns
Customizable Settings
- Pattern Selection: Enable/disable specific pattern types
- Tolerance Adjustment: Fine-tune pattern recognition sensitivity (5-30%)
- Color Customization: Personalize visual appearance
- Information Table: Optional statistics display
Trading Applications
Entry Signals
- Reversal Zones: Identify high-probability reversal areas at pattern completion
- Confluence Trading: Combine with other technical indicators for confirmation
- Risk Management: Use pattern structure to define stop-loss levels
Market Analysis
- Support/Resistance: Pattern points often act as future S/R levels
- Price Targets: Fibonacci extensions provide potential profit targets
- Market Structure: Understand underlying market geometry and rhythm
Strategy Integration
- Swing Trading: Ideal for medium-term position entries
- Position Trading: Long-term trend reversal identification
- Day Trading: Intraday reversal patterns on lower timeframes
How to Use
- Add to Chart: Apply the indicator to any timeframe and instrument
- Configure Settings: Adjust tolerance, colors, and pattern types as needed
- Wait for Completion: Patterns are valid only when D point is formed
- Confirm with Volume: Look for volume confirmation at pattern completion
- Set Stop Loss: Place stops beyond X point for 5-point patterns, or A point for ABCD
- Target Levels: Use Fibonacci extensions for profit targets
Important Notes
- Pattern Completion: Wait for full pattern formation before taking action
- Market Context: Consider overall market trend and conditions
- Risk Management: Always use appropriate position sizing and stops
- Backtesting: Test the indicator on historical data before live trading
- Multiple Timeframes: Analyze patterns across different timeframes for confirmation
Technical Requirements
- Lookback Period: Adjustable pivot detection sensitivity
- Depth Setting: Controls how far back the algorithm searches for patterns
- Memory Efficient: Optimized for real-time performance without lag
This indicator is suitable for all experience levels, from beginners learning harmonic patterns to advanced traders seeking automated pattern recognition. The combination of mathematical precision and visual clarity makes it an essential tool for harmonic trading strategies.
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.