Read the XABCD ratios with the right denominators
For a bullish candidate, X is a low, A a high, B a lower retracement, C a rebound below A and D a decline below B but above X. Reverse the directions for the bearish case. Define each leg length as the absolute difference between its endpoint prices; reject a zero-length denominator.
- The D retracement starts at A: for a bullish XA from 100 to 200, the 0.786 level is 200 - 0.786 × 100 = 121.4. Measuring 78.6% upward from X would produce a different price.
- Ratios constrain the same five prices, so they are not independent settings. Exact equality at every nominal ratio may be impossible; a detector needs an explicit confluence and tolerance policy.
- The harmonic-pattern overview compares multiple families. AB=CD examines the four-point leg relationship. This page adds the X anchor, Gartley-specific ratio conventions and confirmation timing.
| Measurement | Calculation | Carney reference |
|---|
| B retracement | |A - B| / |A - X| | 0.618 |
| C retracement | |C - B| / |A - B| | 0.382 to 0.886 in Volume One |
| D retracement | |A - D| / |A - X| | 0.786 |
| BC projection | |C - D| / |C - B| | 1.27 or 1.618 |
| Leg equality | |C - D| / |A - B| | 1.0 for equivalent AB=CD |
Published definitions are not interchangeable
TradingView documents XABCD as a manual drawing tool. Its bullish Gartley example uses BC/AB from 0.618 to 0.786 and CD/BC from 1.27 to 1.618. Carney's Gartley page instead names 1.27 or 1.618 BC projections with AB=CD convergence at the 0.786 XA area; Volume One gives a wider C range. A continuous interval accepts values that an endpoint test rejects.
- Record the source and edition in a detector specification. Do not silently combine the widest allowance from every reference and call the result the official Gartley definition.
- A ratio label on a manually placed drawing does not establish that its points were objectively selected or that a reversal was confirmed.
- The hypothetical G-1 specification below uses the TradingView example ranges plus explicit D and leg-equality checks. It is a custom teaching model, not a reproduction of a TradingView detector or a strict Carney implementation.
Calculate one candidate and expose the disagreement
Take hypothetical bullish points X = 100, A = 200, B = 138.2, C = 183.2 and D = 121.4, in that time order. Their lengths are XA = 100, AB = 61.8, BC = 45 and CD = 61.8. The table evaluates unrounded values; displayed decimals are rounded for reading.
- The candidate passes these five G-1 tests. This is an arithmetic result, not a historical trade or evidence of profitability.
- If the BC projection instead must lie within 0.03 of either 1.27 or 1.618, it fails: 1.373333 is about 0.103333 from the nearer endpoint. A broad interval and two narrow bands do not identify the same patterns.
- Keep the price ordering check separate from the ratios. Absolute distances can pass numeric tests even when the points do not alternate in the intended direction.
| Test | Calculated value | Illustrative G-1 allowance |
|---|
| AB / XA | 0.618 | 0.608 to 0.628, inclusive |
| BC / AB | 0.728155 | 0.618 to 0.786, inclusive |
| AD / XA | 0.786 | 0.776 to 0.796, inclusive |
| CD / BC | 1.373333 | 1.27 to 1.618, inclusive |
| CD / AB | 1.000 | 0.97 to 1.03, inclusive |
Make tolerance measurable and retain rejected matches
For G-1, the B and D allowances are absolute ratio errors of 0.010. This means one percentage point of XA, not a 1% relative error in the target ratio. With XA = 100, each allows one price unit around its target. Choose the policy before evaluating outcomes and retain it across the sample.
- Use one price source consistently, such as candle highs for high pivots and lows for low pivots. Switching between closes and wicks to rescue a match changes the input data.
- Define pivot strength, minimum spacing, maximum pattern duration and overlapping-candidate handling alongside the ratio checks. These choices can alter the sample even with identical Fibonacci thresholds.
- A D point beyond X fails the bullish price ordering used here. Reject the Gartley candidate rather than relabeling it automatically as another harmonic pattern without checking that pattern's rules.
| Hypothetical alteration | Result | Reason |
|---|
| Change B from 138.2 to 136.0 | Reject | AB / XA becomes 0.640, outside 0.608 to 0.628 |
| Change D from 121.4 to 119.0 | Reject | AD / XA becomes 0.810, outside 0.776 to 0.796 |
| Keep ratios but select a later C after seeing a rebound | Reject the evaluation method | The point-selection rule changed after the outcome |
| Expand tolerance until a losing example disappears | Invalid comparison | The revised detector must be evaluated as a separate version |
D has a price timestamp and a confirmation timestamp
For a timing illustration, call a low pivot confirmed only when three completed bars on each side have strictly higher lows; reject ties. Apply the mirrored rule to highs. Assume X, A, B and C are already confirmed, and all selected points meet the chosen spacing rules. A D low at bar 50 cannot pass this test until bar 53 closes.
- A label drawn back at bar 50 must still disclose that the detector learned about D at bar 53. An alert or simulated entry cannot be backdated to the earlier low.
- An optional, separate entry filter might require a completed close above the high of the D candle, on or after pivot confirmation. Freeze that high when D qualifies; a matching Gartley alone does not satisfy this extra condition.
- In a test using that extra filter, specify an expiry window and invalidation precedence. For example, invalidate first if a completed bar has a low below the saved D, then evaluate the entry condition. This is a chosen rule, not a universal Gartley stop.
- Confirmation can arrive after part of a rebound has already occurred. Waiting for closed bars limits intrabar changes but does not justify an unconditional non-repainting claim; feed revisions and other script behavior still matter.
| Event | Information available then | Permitted label |
|---|
| Bar 50 trades at 121.4 | Future bars 51 to 53 are unknown | Provisional D only |
| Bar 52 closes | Only two right-side bars have completed | Still provisional |
| Bar 53 closes with all three lows above 121.4 | D is a confirmed pivot; evaluate the saved ratios | G-1 candidate confirmed at bar 53 |
| Alternative: bar 52 makes a 120.8 low | The bar-50 pivot test fails | Discard that D; any later candidate starts a new evaluation |
Draw it in TradingView, then specify a detector
Use the XABCD drawing tool to place the five selected pivots in time order. Its Coordinates controls accept price and bar values, so the hypothetical example can be reconstructed without measuring screen angles. Check the ratio denominators against the convention you selected.
- For a Pineify coding request, name the Pine Script version and the detector version separately. For example, request Pine Script v6 implementing your written G-1 rules, with the complete pivot, tolerance and candidate-selection policy attached.
- Ask for measured ratios, rejection reasons, the D pivot bar and the D confirmation bar as inspectable outputs. Treat those as implementation requirements to review, not as existing outputs of this educational page.
- Request syntax validation, inspect the generated logic and replay the same sample bar by bar. A compiling detector can still use the wrong denominator or label an event too early.
- Before adding a strategy, define order timing, stops, position sizing, costs and exits. This page provides no tested win rate, best timeframe or expected return.