Williams Alligator

Calculate Bill Williams’ Alligator and Gator Oscillator: three smoothed averages of the median price, shifted forward, whose order and spread show whether a trend is forming (the alligator eats) or not (it sleeps).

The Alligator of Williams (1995) consists of three smoothed moving averages (Wilder’s smoothing) of the median price, each moved forward by a number of periods: the Jaw (13 periods, shifted 8), the Teeth (8, shifted 5) and the Lips (5, shifted 3). When the lines are intertwined the market has no trend and the alligator sleeps; when they fan out in the order Lips, Teeth, Jaw, a trend is under way and it eats. The Gator Oscillator shows the same as two histograms: the distance between the Jaw and the Teeth above zero and the distance between the Teeth and the Lips below.

The Jaw, Teeth and Lips are shifted forward jaw_shift, teeth_shift and lips_shift periods.

The formula is as follows:

\[\text{Median Price} = \frac{\text{High} + \text{Low}}{2}\] \[\text{Jaw} = \text{SMMA}(\text{Median Price}, \texttt{jaw\_window})\] \[\text{Teeth} = \text{SMMA}(\text{Median Price}, \texttt{teeth\_window})\] \[\text{Lips} = \text{SMMA}(\text{Median Price}, \texttt{lips\_window})\] \[\text{Gator Upper} = \left\lvert \text{Jaw} - \text{Teeth}\right\rvert\] \[\text{Gator Lower} = -\left\lvert \text{Teeth} - \text{Lips}\right\rvert\]

with SMMA Wilder’s smoothed moving average.

Also known as: Alligator, Williams Alligator, Gator Oscillator, jaw, teeth, lips.

Example · AAPL · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_williams_alligator:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["AAPL"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_williams_alligator().xs("AAPL", level=1, axis="columns")

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

Where were the jaw, teeth and lips of the Williams Alligator for Apple, and how wide were the gator's upper and lower bars, over the last five trading days of 2025, with data from 2021?

Which returns:

Parameters

get_williams_alligator accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the high and low prices are adjusted for dividends in the same way."Close"
jaw_windowintThe number of periods of the Jaw. Defaults to 13.13
teeth_windowintThe number of periods of the Teeth. Defaults to 8.8
lips_windowintThe number of periods of the Lips. Defaults to 5.5
jaw_shiftintThe number of periods the Jaw is shifted forward. Defaults to 8.8
teeth_shiftintThe number of periods the Teeth are shifted forward. Defaults to 5.5
lips_shiftintThe number of periods the Lips are shifted forward. Defaults to 3.3
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the Alligator. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
transformstr | list[str] | NoneTime series steps applied in order, such as “sma:12” (moving average), “ema:12”, “std:12”, “zscore:60”, “percentile:120”, “yoy”, “pct_change:3,annualize:3”, “log”, “diff”, “cumsum” or “hp_trend” and “hp_cycle” (Hodrick-Prescott), before growth. A window needs that many periods of history, so the first periods can be empty. Defaults to None.None
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Williams, B. (1995). “Trading Chaos: Applying Expert Techniques to Maximize Your Profits.” John Wiley & Sons.
  • Paper Williams, B. & Gregory-Williams, J. (2004). “Trading Chaos.” 2nd ed. John Wiley & Sons.
  • Library Referenced against pandas-ta’s alligator
Share