All indicators
Trend / Price pane

Williams Alligator

Bill Williams' jaw, teeth and lips: three smoothed averages of the median price, shifted forward, that intertwine in ranges and fan out in trends.

  • Alligator
  • Built into Spectral
  • Updates every tick
  • alligator
  • bill williams
  • jaw teeth lips
  • smoothed moving average
  • smma
  • trend

By Spectral · v1.0.0

MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.

Already in Spectral: add it from the Indicators toolbox. The file here is the same indicator written as a custom indicator, to change or learn from. Installed, it appears next to the built-in one, marked Custom.

Williams Alligator on a Spectral chart
Spectral chart with sample market data, default settings.

Overview

The Alligator by Bill Williams is three smoothed moving averages (Wilder's smoothing) of the median price, the middle of each bar's high and low. The jaw (blue, 13 bars) is drawn 8 bars ahead, the teeth (red, 8 bars) 5 bars ahead and the lips (green, 5 bars) 3 bars ahead, so the lines reach into the space right of the last bar.

How to read it

When the three lines intertwine, the alligator sleeps: the market has no trend and trend trades get chopped up. When they separate and line up in order (lips, teeth, jaw from top to bottom in an uptrend, the reverse in a downtrend), the alligator wakes and eats: a trend is under way. Lines converging again show the trend tiring.

Price crossing the lines and the lines starting to fan out is the usual early signal; Williams combined it with his fractals and the Awesome Oscillator.

Settings and limitations

The lengths 13, 8 and 5 and offsets 8, 5 and 3 are Williams' originals, built from Fibonacci numbers. The offsets only move the lines and do not change their values. Each line appears after its length in bars.

Notes

Matches TradingView's Williams Alligator: smoothed moving averages (the same as Wilder's RMA, seeded with a simple average) of the median price, with the same offsets.

Settings

Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.

SettingTypeDefaultRange or optionsWhat it does
Jaw lengthWhole number131 – 500Number of bars in the jaw, the slowest smoothed moving average.
Teeth lengthWhole number81 – 500Number of bars in the teeth, the middle smoothed moving average.
Lips lengthWhole number51 – 500Number of bars in the lips, the fastest smoothed moving average.
Jaw offsetWhole number80 – 100Bars the jaw is drawn ahead of the bar it was computed on.
Teeth offsetWhole number50 – 100Bars the teeth are drawn ahead of the bar they were computed on.
Lips offsetWhole number30 – 100Bars the lips are drawn ahead of the bar they were computed on.

What it draws

Lines

  • Jawsolid · 1.5 px · primary#2962FF
  • Teethsolid · 1.5 px#E91E63
  • Lipssolid · 1.5 px#66BB6A

Source

Save it as williams-alligator.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.

// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** @type {import('./spectral-indicator').IndicatorV2} */
export default {
  schemaVersion: 2,
  id: 'williams-alligator',
  name: 'Williams Alligator',
  shortName: 'Alligator',
  version: '1.0.0',
  author: 'Spectral',
  description: 'Bill Williams\' jaw, teeth and lips: three smoothed averages of the median price, shifted forward, that intertwine in ranges and fan out in trends.',
  pane: 'price',
  live: { lookback: 0 },
  inputs: {
    jawLength: { type: 'integer', label: 'Jaw length', default: 13, min: 1, max: 500, description: 'Number of bars in the jaw, the slowest smoothed moving average.' },
    teethLength: { type: 'integer', label: 'Teeth length', default: 8, min: 1, max: 500, description: 'Number of bars in the teeth, the middle smoothed moving average.' },
    lipsLength: { type: 'integer', label: 'Lips length', default: 5, min: 1, max: 500, description: 'Number of bars in the lips, the fastest smoothed moving average.' },
    jawOffset: { type: 'integer', label: 'Jaw offset', default: 8, min: 0, max: 100, description: 'Bars the jaw is drawn ahead of the bar it was computed on.' },
    teethOffset: { type: 'integer', label: 'Teeth offset', default: 5, min: 0, max: 100, description: 'Bars the teeth are drawn ahead of the bar they were computed on.' },
    lipsOffset: { type: 'integer', label: 'Lips offset', default: 3, min: 0, max: 100, description: 'Bars the lips are drawn ahead of the bar they were computed on.' },
  },
  plots: {
    jaw: { label: 'Jaw', color: '#2962FF', lineWidth: 1.5, primary: true, offset: 'jawOffset' },
    teeth: { label: 'Teeth', color: '#E91E63', lineWidth: 1.5, offset: 'teethOffset' },
    lips: { label: 'Lips', color: '#66BB6A', lineWidth: 1.5, offset: 'lipsOffset' },
  },
  docs: {
    overview: 'The Alligator by Bill Williams is three smoothed moving averages (Wilder\'s smoothing) of the median price, the middle of each bar\'s high and low. The jaw (blue, 13 bars) is drawn 8 bars ahead, the teeth (red, 8 bars) 5 bars ahead and the lips (green, 5 bars) 3 bars ahead, so the lines reach into the space right of the last bar.',
    howToRead: 'When the three lines intertwine, the alligator sleeps: the market has no trend and trend trades get chopped up. When they separate and line up in order (lips, teeth, jaw from top to bottom in an uptrend, the reverse in a downtrend), the alligator wakes and eats: a trend is under way. Lines converging again show the trend tiring.\n\nPrice crossing the lines and the lines starting to fan out is the usual early signal; Williams combined it with his fractals and the Awesome Oscillator.',
    settings: 'The lengths 13, 8 and 5 and offsets 8, 5 and 3 are Williams\' originals, built from Fibonacci numbers. The offsets only move the lines and do not change their values. Each line appears after its length in bars.',
    notes: 'Matches TradingView\'s Williams Alligator: smoothed moving averages (the same as Wilder\'s RMA, seeded with a simple average) of the median price, with the same offsets.',
  },
  calculate(ctx) {
    const { bars, inputs, ta } = ctx;
    const median = bars.map((bar) => (bar.high + bar.low) / 2);
    return {
      plots: {
        jaw: ta.rma(median, inputs.jawLength),
        teeth: ta.rma(median, inputs.teethLength),
        lips: ta.rma(median, inputs.lipsLength),
      },
    };
  },
};

Adapt it with an LLM

Paste this into your assistant and replace the second-to-last line with the change you want.

Start from this Spectral custom indicator: https://spectral.trade/indicators/williams-alligator.js
Format reference: https://spectral.trade/docs/custom-indicators.llm.md
Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match.
Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow.
Change I want: <describe the change>
Answer with the complete file in one code block, ready to save as <id>.js.