Purpose of the Alligator
The Alligator, developed by Bill Williams, combines three smoothed moving averages that are shifted forward on the chart: the Jaw (slowest), the Teeth and the Lips (fastest). When the lines are intertwined, the market has no clear trend. When they spread apart in order, a trend is under way.
How It Works
When you select Alligator in the Trade Rule block, you can configure it with the following settings:
Jaw Period of Alligator
The number of candles for the slowest line (standard: 13).
Jaw Shift of Alligator
How many candles the Jaw is moved forward on the chart (standard: 8).
Teeth Period of Alligator
The number of candles for the middle line (standard: 8).
Teeth Shift of Alligator
How many candles the Teeth are moved forward (standard: 5).
Lips Period of Alligator
The number of candles for the fastest line (standard: 5).
Lips Shift of Alligator
How many candles the Lips are moved forward (standard: 3).
MA Method of Alligator
Method used to calculate the moving average.
Simple: Equal weight to all values.
Exponential: More weight on recent data.
Smoothed: Longer-term smoothing with reduced noise.
Weighted: Highest weight on the most recent data, decreasing linearly.
Applied Price of Alligator (What the lines are calculated from)
Close Price: Uses the candle's closing price.
Open Price: Uses the candle's opening price.
High Price: Uses the highest price in the candle.
Low Price: Uses the lowest price in the candle.
Median Price: (High + Low) ÷ 2
Typical Price: (High + Low + Close) ÷ 3
Weighted Price: (High + Low + Open + Close) ÷ 4
Mode of Alligator (Which line to use)
Jaw: The slowest line.
Teeth: The middle line.
Lips: The fastest line.
Time Frame of Alligator
Sets the chart time frame for the Alligator calculation.
Can be replaced with a variable or input for quick testing and optimization.
Candle ID of Alligator
Defines which candle the calculation starts from.
0: Current candle (still forming).
1: Most recently closed candle.
Higher IDs refer to older candles.
Adjust of Alligator (Modify the Result)
Apply an adjustment to the calculated value by adding, subtracting, multiplying, or dividing by a number.
Example
If you set:
Jaw: 13 / shift 8
Teeth: 8 / shift 5
Lips: 5 / shift 3
Mode: Lips
Candle ID: 1
You get the value of the Lips line for the most recently closed candle. Compare it with the Teeth and the Jaw to see whether the lines are in trending order.
Use Cases
Detect an uptrend when Lips > Teeth > Jaw.
Detect a downtrend when Lips < Teeth < Jaw.
Stay out of the market while the three lines are intertwined.
Can also be used as a Custom level stop-loss or take-profit, as a pending-order price, and as the Modify SL/TP reference price.
⚠ Tip: The Alligator works best in trending markets. Combine it with the Fractals or the Awesome Oscillator, as Bill Williams intended.
⚠ Note: When you use Crosses Above or Crosses Below with this indicator, the cross is currently calculated on its first line, whatever Mode you select. To compare two specific lines, use > or < instead.

