OPEN-SOURCE SCRIPT
업데이트됨 Harmonic XABCD Pattern Detector

Overview
This overlay indicator scans the chart for classic XABCD harmonic formations using pivot-based structure detection. When a valid five-point pattern completes at pivot D, it draws the zigzag legs, labels key ratios, and optionally highlights the Potential Reversal Zone (PRZ) near D.
The script is designed for visual pattern recognition and education. It does not place orders, generate trade signals for automation, or guarantee future price behavior.
Supported patterns
Key features
How detection works
The script identifies swing pivots using configurable left/right bar settings, then evaluates consecutive pivot sequences against harmonic ratio rules. A pattern is drawn only after the pivot structure and ratio checks pass the selected mode (Strict or Soft).
Important: Pivot D is confirmed only after the configured Pivot Right Bars have closed. Until then, price action near the projected zone is handled by the See the Future module, not as a completed pattern.
Main settings
Alerts
Three optional alert conditions are available:
Limitations
This overlay indicator scans the chart for classic XABCD harmonic formations using pivot-based structure detection. When a valid five-point pattern completes at pivot D, it draws the zigzag legs, labels key ratios, and optionally highlights the Potential Reversal Zone (PRZ) near D.
The script is designed for visual pattern recognition and education. It does not place orders, generate trade signals for automation, or guarantee future price behavior.
Supported patterns
- Gartley
- Bat
- Butterfly
- Crab
- Deep Crab
- Cypher
- Shark
- AB=CD
- Three Drives (7-point structure)
Key features
- Strict and Soft modes — Strict uses fixed Fibonacci ratio rules. Soft applies a user-defined percentage tolerance around standard harmonic levels.
- PRZ box — Optional orange zone at D showing the projected reversal area.
- Structural stop line — Optional stop reference beyond D based on CD leg size and ATR buffer (visual reference only).
- Pattern score and confluence — Each completed pattern receives a quality score and a confluence count based on nearby pivot density.
- See the Future — When X-A-B-C is complete but D is not yet confirmed, the script can project possible D zones for active setups.
- On-chart table — Summary panel with pivot count, detection mode, pending projection status, average pattern score, and recent pattern history.
- Alerts — Optional alerts for pattern completion, future zone touch, and possible formation in the projected D zone.
How detection works
The script identifies swing pivots using configurable left/right bar settings, then evaluates consecutive pivot sequences against harmonic ratio rules. A pattern is drawn only after the pivot structure and ratio checks pass the selected mode (Strict or Soft).
Important: Pivot D is confirmed only after the configured Pivot Right Bars have closed. Until then, price action near the projected zone is handled by the See the Future module, not as a completed pattern.
Main settings
- Pivot Settings — Pivot left/right bars and maximum stored pivots.
- Filter Settings — Minimum leg size (ATR multiplier) and ATR period.
- Detection Mode — Strict vs Soft ratio control; Soft tolerance (%).
- Pattern Filters — Enable or disable individual harmonic types.
- Visual Settings — Labels, leg ratios, butterfly wings, PRZ, stop line, colors, and history table rows.
- See the Future — Projected D zones, zone merge, touch markers, and extension length.
- Storage — Maximum stored patterns for redraw and history.
- Alerts — Toggle alert conditions for completion and future-zone events.
- Analytics — Confluence ATR multiplier for pivot clustering near PRZ.
Alerts
Three optional alert conditions are available:
- Pattern Completed — a valid XABCD (or Three Drives) formation is detected and drawn.
- Future Zone Touched — price enters a projected D zone while XABC is still active.
- Possible Formation — price reaches an extremum inside a projected D zone before D is confirmed.
Limitations
- Harmonic patterns are subjective geometric models. Different pivot settings, timeframes, and tolerance modes will produce different results.
- Overlapping patterns are filtered, but dense or choppy markets may still produce frequent redraws on setting changes.
- The optional stop line is a structural visual reference, not a validated risk-management rule.
- See the Future projections are hypothetical until pivot D is confirmed by the pivot engine.
- This indicator runs on and is intended for manual chart analysis on TradingView.
Pine Script®
Disclaimer
This script is provided for informational and educational purposes only. It does not constitute investment advice, financial advice, trading advice, or a recommendation to buy or sell any instrument.
Trading involves substantial risk of loss. Past pattern occurrences do not guarantee future results. Always do your own research and consult a qualified financial professional before making trading decisions.
The author makes no warranties about the accuracy, completeness, or suitability of the detected patterns for any particular market or timeframe.
릴리즈 노트
Comment lines have been edited.릴리즈 노트
Several bugs in replay mode have been fixed.오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Love for AlgoTrading
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Love for AlgoTrading
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.