
Bill Williams' Alligator — 3 SMMAs (Jaw 13 / Teeth 8 / Lips 5) with optional Awesome Oscillator confirmation + sleeping-state exit.
The Alligator was introduced by Bill Williams in his 1995 book Trading Chaos. The metaphor: an alligator that wakes up (mouth opens) to feed during trends, then sleeps (mouth closes) during ranges. Three Smoothed Moving Averages on the median price (high+low)/2:
The forward shift is critical to Williams' original design — it introduces lag, not look-ahead. The value at bar T uses data only up to T-shift.
Bullish alignment: Lips > Teeth > Jaw. Bearish: Lips < Teeth < Jaw.
Entry rule: alignment crossover into bullish state (alignment was NOT bullish on previous bar AND IS bullish on current bar). With optional AO confirmation (Awesome Oscillator must also be bullish: AO[T] > AO[T-1] AND AO[T] > 0): adds a filter to suppress weak signals.
Exit rules:
sleeping_threshold × ATR(14). The Alligator is asleep — range market — exit before whipsaw.Calc modes:
smma_shifted (default, Bill Williams classic): SMMA + forward shift.sma_simple (TradingView-style): plain SMA, no shift. Different signal characteristic.Universal — works on any liquid asset class. The 3-line + AO combo is age-old technical analysis, well understood, transparent.
| Name | Default | Range | Description |
|---|---|---|---|
| Calc Mode | smma_shifted | – | `smma_shifted`: Bill Williams classic with forward-shift. `sma_simple`: TradingView-style plain SMA, no shift. |
| Jaw Length | 13 | 3–200 | Slow line period. |
| Teeth Length | 8 | 3–200 | Medium line period. |
| Lips Length | 5 | 3–200 | Fast line period. |
| AO Confirmation | – | Require Awesome Oscillator to also confirm bullish before entry. | |
| Sleeping Threshold (×ATR) | 0.5 | 0.1–5 | Exit when range of 3 lines is below this × ATR — Alligator is asleep, range market detected. |
The pre-baked mini-backtest is refreshed daily — check back soon or start a live run in the Arena.
Run in Arena →// Three SMMAs on median price = (high+low)/2
median = (high + low) / 2
jaw = SMMA(median, jawLength, shift=jawShift) // 13/+8
teeth = SMMA(median, teethLength, shift=teethShift) // 8/+5
lips = SMMA(median, lipsLength, shift=lipsShift) // 5/+3
// Awesome Oscillator
ao = SMA(median, aoFast) - SMA(median, aoSlow) // default 5 - 34
for each bar:
bullAlign = lips > teeth > jaw
bullAlignPrev = lipsPrev > teethPrev > jawPrev
bearAlign = lips < teeth < jaw
// ENTRY: alignment crossover
if position.is_flat and bullAlign and not bullAlignPrev:
if aoConfirmation and (ao <= aoPrev or ao <= 0):
continue // AO not bullish, skip
BUY
// EXIT: bearish-alignment OR sleeping (range < threshold × ATR)
if position.is_long:
if bearAlign:
SELL
if (max(lips,teeth,jaw) - min(lips,teeth,jaw)) < sleepingThresholdAtrMult * ATR(14):
SELL // alligator is asleepWilliams' original 1995 design uses forward-shifts to introduce intentional lag, not look-ahead. The value at bar T uses data only up to T-shift bars ago (e.g. Jaw at bar T = SMMA of data up to bar T-8). This delays signals but makes them more robust against intra-bar noise. The `sma_simple` mode is for traders who prefer TradingView's no-shift convention.
Two EMAs plus an ATR-based neutral zone — like the commercial Larsson Line, but tunable, transparent, and backtested. Choose your bias.
The ratcheting ATR-based trend follower — one of the most popular indicators on TradingView. Dynamic stop levels that lock in as the trend confirms.
Check out our Strategy Insights Reports — pre-baked deep-dives with historical results, comparisons, and market context.