Gartley Pattern

The Gartley is a 5-point XABCD harmonic pattern. It is one of the original harmonic patterns and is characterised by a precise 0.618 AB retracement and a 0.786 AD retracement of the XA leg.

XABCD Structure

DirectionXABCD
BullishLowHighLowHighLow → Buy
BearishHighLowHighLowHigh → Sell

The PRZ (Potential Reversal Zone) is the price band between C and D.

Fibonacci Ratios

FIB_TOLERANCE = 0.05 (5%) applies to all isNear checks.

LegMeasurementTargetCheck Type
ABRetracement of XA0.618isNear (exact)
BCRetracement of AB0.382–0.886inRange
ADRetracement of XA0.786isNear (exact)

Confidence

Confidence is the mean accuracy across the AB and AD legs:

confidence = 1 − (abError + adError) / 2

Clamped to [0, 1].

SL/TP

  • SL: beyond X (or prevSwingPrice if more extreme), ±0.1% buffer
  • TP1: D + 0.382 × |A − D|
  • TP2: D + 0.618 × |A − D|
  • TP3: A price

Levels are scalable via per-pattern TradingConfig multipliers. See TP Level Calculation.