INVITE-ONLY SCRIPT

Harmonic patterns

164
This indicator is an automated technical analysis tool designed to identify 16 different harmonic and geometric price patterns, ranging from classic Gartley and Bat patterns to exotic models like the Nen Star and Black Swan. Unlike standard detectors, this script incorporates a proprietary Similarity Rating System to help traders distinguish between high-probability setups and approximate formations.


Technical Logic and Methodology
The script utilizes a pivot-based ZigZag algorithm with a default lookback of 18 pivots to identify structural swing highs and lows. Once pivots are established, the system calculates the internal Fibonacci retracement and extension ratios between five key points (X, A, B, C, and D).


Ratio Validation: The script compares real-time price action against ideal harmonic ratios (e.g., 0.618 for Gartley’s B-point) within a user-defined error margin.


Similarity Rating: A percentage-based score is calculated by measuring the cumulative deviation of all legs from their mathematical ideals. Only patterns exceeding the 79% Similarity Threshold are displayed to ensure signal quality.


Dynamic Targets: Take Profit (TP) zones are calculated based on the vertical distance of the XA leg, projected from the D-point at 0.618, 1.0, and 1.618 levels.


How to Use

Filter Patterns: Use the "General Settings" to adjust the "Pattern Size" (bars) and the "Similarity Rating" to filter out low-quality setups.

Execution: Once a pattern is labeled (e.g., "🦋 GARTLEY"), the script draws dynamic TP boxes. Traders typically look for price rejection at the D-point before targeting TP1 or TP2.

Alerts: The script includes a universal alert condition that triggers as soon as a valid, high-rating pattern completes at the D-point.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.