# Alligator

A Trend concept (Trend-following systems) in the LuxAlgo Library, with 1 indicator implementation.

## What is the Alligator?

The Alligator is Bill Williams' three-line trend tool from the mid-1990s. It plots three smoothed moving averages of median price (high plus low, divided by two), each displaced into the future: the Jaw, 13 periods shifted 8 bars forward; the Teeth, 8 periods shifted 5; and the Lips, 5 periods shifted 3. The smoothing is the slow Wilder-style variety, a smoothed average that behaves like an [EMA](https://www.luxalgo.com/library/concept/ema/) of roughly twice the stated length, and the forward shift draws each line ahead of the bars that produced it.

Williams developed it within his Profitunity method, laid out across Trading Chaos (1995) and New Trading Dimensions (1998), with the latter giving the Alligator its fullest treatment alongside his fractal patterns and the Awesome Oscillator. His premise was that markets trend only a minority of the time, so an indicator's first job is refusing signals: the Alligator was built to keep a trader flat until the animal wakes.

Williams' metaphor carries the interpretation. When the lines braid together the alligator sleeps and the market is ranging; when Lips cross above Teeth and Teeth above Jaw and the lines fan open, the alligator eats and a trend is running; when the lines converge again the animal is sated and the move is likely spent. In Williams' full method, entries come from fractal breakouts beyond the open mouth.

Mechanically it is a compact moving-average ribbon: three lookbacks whose order, separation, and slope define a regime. The forward displacement is the debated choice: supporters say it separates the lines from price so a cross into the mouth stands out, while critics note it adds no information an undisplaced average lacks and can make historical alignment look cleaner than it felt in real time. Either way, the sleep-wake vocabulary proved durable and the tool remains one of the most recognizable retail trend filters.

## How to read the Alligator on a chart

Add the Alligator with its standard settings and classify which phase the three lines are in.

1. Sleeping: Jaw, Teeth, and Lips run flat, close together, and repeatedly crossing, with price weaving through them; the no-trade regime in Williams' method.
2. Awakening: the Lips pull away from the Teeth and the Teeth from the Jaw, the lines fan in order (Lips above Teeth above Jaw for longs, inverted for shorts), and price closes beyond all three.
3. Eating: the fan widens and holds its order while pullbacks toward the Lips or Teeth stall without closing through the Jaw; the trend-continuation zone.
4. Sated: after an extended run the lines flatten and converge again, which Williams read as the move being digested, a cue to tighten or exit rather than initiate.

## How it's calculated

Bill Williams' Alligator draws three smoothed moving averages of median price, each shifted into the future, whose order and spread gauge the trend.

```
P_t = (H_t + L_t) / 2
SMMA(P, n)_t = (SMMA(P, n)_{t-1} × (n - 1) + P_t) / n
Jaw_t = SMMA(P, 13)_t, plotted 8 bars forward
Teeth_t = SMMA(P, 8)_t, plotted 5 bars forward
Lips_t = SMMA(P, 5)_t, plotted 3 bars forward

  H_t: high of bar t
  L_t: low of bar t
  t: bar index
  P_t: median price of bar t
  SMMA(P, n)_t: n-bar smoothed moving average of P at bar t, seeded with an n-bar simple average (SMMA(P, n)_{t-1} is the prior value)
  n: smoothing length (13 for Jaw, 8 for Teeth, 5 for Lips)
  Jaw_t: blue line (length 13, offset +8)
  Teeth_t: red line (length 8, offset +5)
  Lips_t: green line (length 5, offset +3)
```

An n-bar SMMA equals an EMA with length 2 × n - 1, so the Jaw behaves like a 25-bar EMA.

The forward offsets only shift the plot; each value is still computed from data up to bar t.

Some implementations apply the averages to close instead of median price; Williams' original uses median price.

## How traders use it

- As a trend filter: longs are considered only while price holds above an upward-fanned mouth (Lips over Teeth over Jaw), shorts the mirror image, and nothing while the lines are entangled.
- As an entry trigger in Williams' method: a fractal [breakout](https://www.luxalgo.com/library/concept/breakout/) beyond the Teeth, taken in the direction the mouth is opening.
- As a trailing exit reference: positions ride until price closes back through the Lips or Teeth, or the lines knot again, which is read as the feeding phase ending.
- As a regime gate: the entangled state reads as range and the open mouth as trend, so the Alligator can stand in for a [trend regime label](https://www.luxalgo.com/library/concept/trend-regime-label/) or [MA slope filter](https://www.luxalgo.com/library/concept/ma-slope-filter/) when choosing a playbook.
- As a pullback map in trends: the Teeth and Jaw act as stepped retracement references, a displaced cousin of [dynamic S/R via MA](https://www.luxalgo.com/library/concept/dynamic-s-r-via-ma/), with continuation entries as price lifts away from them.
- Across timeframes: a higher-timeframe mouth sets the permitted direction while a lower-timeframe awakening times the entry.

## Alligator vs other moving-average trend tools

- **Moving Average Crossovers** (https://www.luxalgo.com/library/concept/moving-average-crossovers/): A crossover system fires an event the instant two averages cross; the Alligator reads the state of three, their order, spread, and slope, plus displacement and staged vocabulary. Crossovers say whether something flipped; the Alligator says what phase holds.
- **MA Ribbon** (https://www.luxalgo.com/library/concept/ma-ribbon/): A ribbon generalizes the same fanning-and-compression logic across many averages, grading agreement between lookbacks more finely. The Alligator is the minimal three-line case, with fixed Fibonacci-numbered settings and a metaphor supplying the reading rules.
- **Supertrend** (https://www.luxalgo.com/library/concept/supertrend/): Supertrend reduces trend to a single ATR-buffered line that flips sides, binary and easy to automate. The Alligator grades conditions into sleeping, awakening, eating, and sated, richer but more interpretive.

## FAQ

### What are the standard Alligator settings?

Bill Williams' published settings are smoothed moving averages of median price, meaning high plus low divided by two: a 13-period Jaw shifted 8 bars forward, an 8-period Teeth shifted 5, and a 5-period Lips shifted 3. The displacement draws each line ahead of the bars that computed it. The values are Fibonacci numbers, but they are conventions, not optimized parameters.

### What does it mean when the Alligator is sleeping?

Sleep is when the three lines flatten and intertwine: the 5, 8, and 13-period averages agree there is no net directional progress, so the market is ranging. Williams taught standing aside during sleep because signals inside the knot whipsaw. He also argued that longer sleeps precede stronger moves; treat that as his claim about markets, not a guarantee.

### Why are the Alligator's lines displaced into the future?

The offsets (8, 5, and 3 bars) plot each average ahead of the bars that computed it, which Williams intended to make crossings into the mouth unmistakable. The shift adds no information a non-displaced average lacks, and because each plotted value was computed several bars earlier, historical charts can look tidier than live trading felt. Treat it as presentation, not prediction.

### What is the Gator Oscillator?

A companion histogram built from the same lines: the absolute Jaw-Teeth distance plots above zero and the Teeth-Lips distance below, each bar colored by whether the gap expanded or contracted. It makes the sleeping and eating phases easier to see at a glance but contains nothing beyond the Alligator's own separations.

### Does the Alligator work in ranging markets?

Its job in a range is keeping you out rather than producing signals. The knot of intertwined lines is the range diagnosis itself, and trades inside it whipsaw because the averages compress onto price and crossings stop meaning anything. Traders wanting range entries pair it with oscillators instead.

### Do the standard 13/8/5 settings need adjusting per market?

Williams published one set of values, drawn from the Fibonacci sequence, and applied them across instruments; they are conventions, not optimized parameters. Because the tool reads bars rather than clock time, most users keep the settings and change the timeframe instead. Re-tuning is possible but sacrifices the shared vocabulary that makes phases comparable across charts.

## Implementations in the Library

- Williams Alligator (LuxAlgo, the standard build of the classic formula): https://www.luxalgo.com/library/indicator/williams-alligator/

## Related concepts

- Supertrend: https://www.luxalgo.com/library/concept/supertrend/
- Parabolic SAR: https://www.luxalgo.com/library/concept/parabolic-sar/
- Chandelier Stop: https://www.luxalgo.com/library/concept/chandelier-stop/
- Donchian Trend Rules: https://www.luxalgo.com/library/concept/donchian-trend-rules/
- ATR Trailing Regime: https://www.luxalgo.com/library/concept/atr-trailing-regime/
- Gann HiLo Activator: https://www.luxalgo.com/library/concept/gann-hilo-activator/
- NRTR: https://www.luxalgo.com/library/concept/nrtr/
- Chande Kroll Stop: https://www.luxalgo.com/library/concept/chande-kroll-stop/
- Halftrend: https://www.luxalgo.com/library/concept/halftrend/
- Trend Magic: https://www.luxalgo.com/library/concept/trend-magic/

---

Source: https://www.luxalgo.com/library/concept/alligator/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/