OPEN-SOURCE SCRIPT
Harmonic Patterns [kingthies]

Harmonic Patterns [kingthies]
What it does
PRZ (Potential Reversal Zone)
How to use
Settings overview
Alerts
Notes
This indicator scans price swings for classic X-A-B-C-D harmonic patterns and plots the structure plus a PRZ (Potential Reversal Zone) to help you frame areas where reactions are statistically more likely. It supports both bullish and bearish setups and can trigger alerts when a new D pivot confirms a pattern.
What it does
- Builds a pivot-based swing map (ZigZag-style) using a configurable Pivot Length.
- Evaluates the most recent 5 swing points (X, A, B, C, D) against harmonic ratio rules with a user-defined tolerance.
- Detects: Gartley, Bat, Butterfly, Crab, Deep Crab, Cypher, Shark (loose).
- Draws the pattern legs (X-A-B-C-D), labels the detection with ratio readouts, and projects a PRZ using 3 target levels (derived from XA/BC logic per pattern).
- Offers two rendering modes:
- Best only: picks the closest match (lowest score) to reduce clutter.
- Show all: plots every valid match (uses filled PRZ boxes to keep object usage under control).
- Best only: picks the closest match (lowest score) to reduce clutter.
PRZ (Potential Reversal Zone)
- PRZ is built from three target levels and expanded into a zone.
- Optional padding uses ATR (ATR multiplier) to widen/narrow the zone for volatility.
- Display modes: Off, Box, Lines, Both.
- Zones can be extended forward by a configurable number of bars to keep the area visible as price develops.
How to use
- Start with Confirm only when D pivot forms enabled (recommended) to reduce false positives while patterns are still forming.
- Adjust Pivot Length based on timeframe:
Lower values = more swings, more signals, more noise.
Higher values = cleaner structures, fewer signals. - Use Ratio Tolerance to control strictness:
Lower tolerance = fewer, higher-confidence matches.
Higher tolerance = more matches, potentially lower quality. - Treat harmonics as context, not a standalone entry system:
- Look for confluence (HTF levels, structure, volume, momentum/RSI divergence, etc.).
- Use your own confirmation and risk plan (invalidations beyond PRZ / beyond D).
- Look for confluence (HTF levels, structure, volume, momentum/RSI divergence, etc.).
Settings overview
- Swings (Pivot ZigZag)Pivot Length: pivot sensitivity.
Use Wicks: uses High/Low; if off, uses Close.
Max Stored Swings: limits stored pivots for performance/object control. - Harmonic DetectionRatio Tolerance (%): allowed deviation around ideal ratios.
Confirm only when D pivot forms: reduces repaint-like behavior.
When multiple match: Best only vs Show all. - Pattern Filters enable/disable each pattern type.
- PRZPRZ Display: Off / Box / Lines / Both.
PRZ Padding (ATR multiplier): volatility-adjusted zone padding.
PRZ Extend (bars): how far to project the zone. - Visuals
- Draw Legs: draws X-A-B-C-D.
- Show Pattern Label: prints pattern name, direction, ratios, and score.
- Label Offset: shift label forward if you want more space.
- Draw Legs: draws X-A-B-C-D.
Alerts
- “Bullish/Bearish Harmonic (Any)” triggers on any detected pattern.
- Per-pattern alerts are included for each supported pattern type.
Notes
- This indicator is educational and intended to assist with pattern recognition and confluence mapping.
- Harmonic patterns do not guarantee reversals—always manage risk and confirm with your own process.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Eric Thies
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Eric Thies
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.