Harmonic pattern calculator: ratios and tolerance
Compare Gartley, Bat, Butterfly, Crab, Deep Crab, Shark and Cypher from four swing prices. The result is a candidate D projection. A potential reversal zone does not confirm that price has reversed.
Enter successive swing prices from one symbol, timeframe and session. Use wick extremes consistently. Prices alone cannot verify chronological order. For Shark, map native 0, X, A, B to these four fields.
A band [L, U] becomes [L × (1 − tolerance), U × (1 + tolerance)]. The default 10% is a broad screen, not a probability.
Candidate projections
Enter all four prices in chronological X, A, B, C order.
All prices use your input units and arithmetic price differences. No live data, observed D, time symmetry, AB=CD check, trade execution or success probability is included. Final D must also satisfy the pattern geometry.
Harmonic pattern ratios used here
These bands make the calculation reproducible. They are a partial geometric screen, not every condition in the source methods. The table shows base ratios before tolerance; intervals accept all values between their endpoints.
| Pattern / source | AB / XA | C measurement | CD / BC | D measurement |
|---|---|---|---|---|
| Gartley | 0.618 | 0.382 to 0.886 BC / AB | 1.270 to 1.618 | 0.786 AD / XA |
| Bat | 0.382 to 0.500 | 0.382 to 0.886 BC / AB | 1.618 to 2.618 | 0.886 AD / XA |
| Butterfly | 0.786 | 0.382 to 0.886 BC / AB | 1.618 to 2.618 | 1.270 AD / XA |
| Crab | 0.382 to 0.618 | 0.382 to 0.886 BC / AB | 2.618 to 3.618 | 1.618 AD / XA |
| Deep Crab | 0.886 | 0.382 to 0.886 BC / AB | 2.000 to 3.618 | 1.618 AD / XA |
| Shark | No ratio filter | 1.130 to 1.618 BC / AB | 1.618 to 2.240 | 0.886 to 1.130 AD / XA |
| Cypher | 0.382 to 0.618 | 1.130 to 1.414 XC / XA | Not used | 0.786 CD / XC |
Gartley and Bat complete inside XA. Butterfly, Crab and Deep Crab complete beyond X. This tool uses the 1.27 XA Butterfly convention and the 2.618 to 3.618 BC band for Crab. Bat uses the narrower 0.382 to 0.500 B band. Other implementations may choose different bands, so compare definitions before comparing signals. Deep Crab's 2.0 lower BC bound follows the Deep Crab chapter in Harmonic Trading Volume One.
Cypher requires C beyond A and uses XC/XA for its extension, then CD/XC for the 0.786 retracement. Shark also extends C beyond A in this interface. Its native labels 0, X, A, B, C map to our X, A, B, C, D. No fixed B retracement band is imposed for Shark, but B must remain between X and A. The Shark impulse structure in Harmonic Trading Volume 3 uses the 1.13 to 1.618 and 1.618 to 2.24 extensions. Shark and 5-0 have different completion rules.
Choose anchors before checking ratios
- Fix the symbol, session, timeframe and price scale. This calculator measures raw price differences, not logarithmic distances.
- Select successive pivots in time order, using the same high/low or close-based rule throughout. For a bullish candidate, XA rises, AB falls and BC rises; reverse the directions for a bearish candidate.
- Keep B strictly inside XA. C stays between B and A for the five conventional structures; Shark and Cypher require C beyond A. Equal adjacent prices cannot define a leg.
- Set tolerance before assessing the outcome. Widening it admits more candidates and broadens the projected price bands. It does not improve the evidence for a reversal.
TradingView's XABCD drawing tool places five anchors manually. Use the ABCD pattern guide to distinguish a four-point measured move from a five-point harmonic structure.
Worked example: a candidate is not a reversal
Illustrative prices, not a historical trade: X = 100, A = 200, B = 138.2, C = 169.1. XA = 100, AB = 61.8 and BC = 30.9. That gives AB/XA = 0.618 and BC/AB = 0.500, within the Gartley bands.
The XA projection is D = A − 0.786 × (A − X) = 121.4. Subtracting from A is essential: a retracement starts at the end of XA. The BC projection runs from 169.1 − 1.618 × 30.9 = 119.1038 to 169.1 − 1.27 × 30.9 = 129.8570. At 0% tolerance, the two projections overlap at 121.4.
At 5% tolerance, the XA band becomes 117.4700 to 125.3300. The BC band becomes 116.6040 to 131.8192, so the overlap is 117.4700 to 125.3300. Neither interval says that price will reach it or reverse there. This example also leaves AB=CD symmetry unchecked, so it is not a fully validated Gartley.
Completion, confirmation and invalidation
Completion means that an observed D satisfies the selected ratio and geometry rules. Confirmation is a separate price event. An illustrative bullish rule could require a later bar to close above the D bar's high; the bearish version would require a close below its low. Choose that rule in advance and test its delay, rather than treating a touch of the projected zone as confirmation.
A Gartley or Bat that continues beyond X violates its retracement geometry. Butterfly and Crab already project beyond X, so the same invalidation rule does not apply. Define the allowed final-leg ratio and maximum risk before evaluating an entry. A projection with no overlap, or a final leg outside the chosen limits, is a failed candidate under those rules.
Automated pivots have another delay. A pivot requiring three right-hand bars is only known three bars after its apparent location. Drawing the label back on the pivot does not make it available earlier. TradingView explains this in its repainting documentation. Record the detection bar when testing alerts, use confirmed data, and include costs and failed candidates in any strategy evaluation.
Educational calculations only, not investment advice. No pattern ranking, reversal probability or return estimate is established by these ratios.
Frequently asked questions
What is a harmonic pattern?
A harmonic pattern is a sequence of price swings compared with specified Fibonacci ratios. Gartley, Bat and Crab use different constraints. A ratio match identifies a candidate structure; it does not establish the probability of a reversal.
Does this calculator confirm a completed XABCD pattern?
No. You supply X, A, B and C; the calculator measures the first three legs and projects possible D prices. It does not receive an observed D, verify timing or AB=CD symmetry, or monitor market prices. A candidate remains incomplete until you check the final leg and your confirmation rules.
What does the ratio tolerance mean?
Tolerance widens each numeric comparison band by a relative percentage. At 5%, a 0.618 target accepts 0.5871 to 0.6489. A range [L, U] becomes [L × 0.95, U × 1.05]. This is a calculator setting, not a confidence level or a standard shared by every harmonic method. Anchor direction rules still apply.
Why does a candidate show no projection overlap?
The B and C ratios can fit while the D projection from XA and the CD projection from BC disagree. The calculator shows both intervals and their intersection. If they do not intersect, it reports no overlap instead of filling the gap and calling it a reversal zone.
How are Cypher and Shark different?
Cypher measures C as XC/XA and projects D as a 0.786 retracement of XC. Shark is normally labeled 0XABC and precedes a possible 5-0 structure; it is not another name for 5-0. This calculator maps Shark points 0, X, A, B, C to its common X, A, B, C, D labels.
Can I use the result directly as a TradingView alert?
This page calculates from manual prices and does not create alerts. For a script, first define pivot selection, tolerance, completion, invalidation and alert timing. Pineify AI Coding Agent can help turn those rules into code that you must review and test on TradingView.
Sources and calculation scope
The table links each pattern to its source. TradingView's Cypher documentation supplies the XC-based measurements; Scott Carney's pattern pages and books supply the other comparison conventions. Source definitions are not identical across all publications, and this calculator does not reproduce a complete trading method. Sources checked October 16, 2026.
For individual projection levels, use the Fibonacci extension calculator. For other formation rules, return to TradingView chart patterns.
Related Tools
Fibonacci Extension Calculator
Calculate Fibonacci extension levels from A, B and C. Compare two-point and three-point formulas, bullish and bearish projections, and anchor choices.
Support & Resistance Calculator
Calculate daily, weekly, and monthly support and resistance levels using Classic, Woodie's, Camarilla, and Fibonacci methods.
Pivot Point Calculator
Calculate pivot points to identify potential support and resistance levels.
Turn your checked ratio rules into a script
Give Pineify AI Coding Agent your pivot rule, ratio bands, tolerance, D confirmation and alert timing. Ask it to generate detection logic, then review the code and test it on TradingView. This manual calculator does not scan charts or create alerts.
Explore AI Coding Agent