Alligator Indicator Settings: The 13, 8, 5 and the Shift
Alligator indicator settings explained: jaw 13, teeth 8, lips 5, and why each second number is a forward shift rather than extra smoothing.
The Alligator's standard settings are three smoothed moving averages of the median price: the jaw on 13 with a shift of 8, the teeth on 8 with a shift of 5, and the lips on 5 with a shift of 3. The second number in each pair is a forward shift that moves the line to the right, and most of the pages that come up for this indicator call it extra smoothing instead. Those two readings draw different charts.
What is the Alligator indicator?
Three smoothed moving averages drawn on the price chart, named after an alligator's jaw, teeth and lips, read by whether they are intertwined or spread apart. The jaw is the slowest line and the lips the fastest, so the lips react first when price turns.
Bill Williams built it. IG dates the idea: "The indicator was developed by American author Bill Williams, who first wrote about it in 1995". LiteFinance names the book, Trading Chaos, and the wider Profitunity system it belongs to.
IG puts the animal plainly: "When the alligator's jaw, teeth, and lips are closed (moving average lines are intertwined), it means it is tired or sleeping." The lines spread, the alligator eats, the lines close again.
The premise underneath it is that markets trend only part of the time. WealthCharts writes that "financial markets trend only 15% to 30% of the time, while trading in sideways or non-trending markets for 70% - 85% of the time". Both IG and WealthCharts present that range as Williams' own belief rather than as a measurement. None of the pages that carry the range publishes a study behind it.
What are the Alligator's default settings?
Jaw 13 with a shift of 8, teeth 8 with a shift of 5, lips 5 with a shift of 3. LiteFinance calls this set the standard: "These are the generally accepted Alligator settings. Any MetaTrader terminal offers such parameters by default."
Each line has two numbers, and the second one moves the line to the right rather than smoothing it further. LiteFinance says so in its glossary of the formula, where "parameter A is the smoothing period, parameter B is a shift to the future", with the worked gloss "SMMA (MEDIAN PRICE, 13, 8) means that a smoothed moving average is calculated from the median price with a period of 13 and shifted forward of 8".
Most of the field disagrees. TradingView describes the jaw as a line that "is smoothed by eight bars on its following values", and The Robust Trader, PrimeXBT and Margex use the same framing, Margex as "8-bar smoothing". It matters because extra smoothing changes the value of the line, while a shift keeps the value and changes where it is drawn.
LiteFinance publishes a second set and calls it a default as well, "period = 21, 13, 8; shift = 13, 8, 5", then labels it "the Alligator indicator default parameters offered in the LiteFinance client profile": a broker's own default, sitting next to the indicator's. And on that same page the prose and the formula block disagree about the lips, which the formula gives a shift of 3 while the prose says the line is "moved by 4 bars into the future". Copy the numbers from the formula block.
What is the Alligator formula?
Median price first, then a smoothed average of it, then the shift. LiteFinance prints all three steps:
MEDIAN PRICE = (HIGH + LOW) / 2
ALLIGATORS JAW = SMMA (MEDIAN PRICE, 13, 8)
ALLIGATORS TEETH = SMMA (MEDIAN PRICE, 8, 5)
ALLIGATORS LIPS = SMMA (MEDIAN PRICE, 5, 3)
The smoothed moving average is a running total rather than a fresh sum each bar. PrimeXBT and The Robust Trader both print it with the brackets in the right place, as "SMMA(i) = (PREVSUM-SMMA(i-1)+CLOSE(i))/N".
A version without those brackets is also in circulation, and it is wrong. WealthCharts prints "SMMA( t ) = PREVSUM - SMMA( t - 1 ) + CLOSE( t ) / N", which in the normal order of operations divides only the closing price by N and leaves the rest of the expression undivided. Use the bracketed form.
Which price does the Alligator average, close or median?
The median price, (high + low) / 2. LiteFinance is explicit: "the three balance lines are the moving averages that are applied to the median value ((high+low)/2), not to the bars' opening or closing prices". IG's whole formula section is one sentence saying the same thing: "To get the alligator indicator formula, you must first determine the median price of each candlestick, which is calculated as (high price + low price) / 2."
Most published formulas take the closing price instead. The Robust Trader opens "Sum1 = sum (close,N)", PrimeXBT's and WealthCharts' recursions both take CLOSE, TradingView defines "CLOSE(i): The current closing price", and Margex averages something it calls a "Closing Average". Build the indicator from one of those and you have a different line from the one Williams described. On a wide-range bar the two sit noticeably apart, because the median ignores where in the range the bar closed.
The one platform-side clue is LiteFinance's note on the MetaTrader parameter dialog, "Apply to: Median Price (HL / 2)". That is one broker's description of one dialog, so check the setting in whatever you plot it on rather than assuming.
What does the Alligator's forward shift do to a bar-by-bar test?
Two things follow from the definition. If the jaw is a 13-period average shifted forward 8 bars, the jaw point sitting next to today's candle is that average as it stood 8 bars ago. You are reading a line whose value was fixed before the last eight candles existed.
The second consequence is at the right edge. The newest jaw value gets drawn 8 bars past the last candle, the teeth 5 bars past it and the lips 3, so all three lines run on into chart space where there is no price yet.
Both change what a crossover means when you step through history one candle at a time, because the cross you are looking at happened in the values some bars before the candle it sits beside. If your rule says the lines crossed on a given bar, write down which bar you mean: the bar the line is drawn at, or the bar its value came from.
How do you read the Alligator: sleeping, awakening, eating, sated?
Four words, each one state of the three lines.
- Sleeping: the lines are intertwined and flat, with no direction. No trend.
- Awakening: the lips cross the slower lines and all three start to point one way.
- Eating: the lines are spread apart and widening in one direction.
- Sated: the lines converge into narrow bands again.
Two pages define sleeping as a downward cross instead, and both contradict themselves a section later. TradingView's takeaways put it this way:
The Alligator is often referred to as "sleeping" when the line is crossing downwards, and "awakening" when it is crossing upwards.
Its own next section then defines the word as "an unusual choppiness in the market where the indicator fires off false positive signals at a high rate". PrimeXBT does the same thing, first tying sleeping to "a cross of down signaling a short position" and then putting the sleeping state as the lines being "tight within a narrow trading range".
A cross down is a direction. Choppiness is a state. Sleeping is the lines intertwined, which is how most of the field describes it.
How do you use the Alligator: what is the actual entry rule?
There are three published versions and they are not the same rule. Pick one before you test.
- The lips crossing both slower lines. The Robust Trader: "a crossover of the green line to the upside indicates a buy signal while a crossover to the downside indicates a sell signal". WealthCharts has the mirror: "When the Lips (5-period moving average) cross down through the other lines it signals bearish opportunity."
- Two crosses, not one. LiteFinance, inside its Fractals strategy: "The lip line should break through the teeth line upside, and the teeth line should cross the jaw line from bottom to top."
- A candle closing through all three lines. PrimeXBT, as the earlier entry: traders "can watch for a price candle to break through all three of the alligator lines, signaling a breakout".
PrimeXBT's crossover version describes a single event as both signals: "When the green line crosses below the blue, it's a bearish sell signal, and when the blue line crosses above the green line, it's a bullish buy signal." Green below blue and blue above green are one crossing seen from two sides, so as written the rule fires a buy and a sell on the same bar.
IG adds the condition that keeps all three versions honest: "A trend only exists when the three lines move in parallel".
How do you turn an Alligator signal into a rule you can test?
A testable rule names four things: the line, the direction, the bar it is measured on, and what confirms it. "The lips close above the teeth and the jaw on a closed daily candle, and all three lines are pointing up" can be tested. A phrase like "the Alligator wakes up" cannot, because two readers will mark different bars.
The sources that like the indicator most are the ones that admit this. The Robust Trader: "Although the Alligator indicator helps, the rules in using it are a bit vague. Therefore, it is necessary to test the indicator using a virtual account before using it, to know when to enter the market at the right time." LiteFinance is more specific about how: "you need to test them on a demo account or on historical data to analyze the past performance. A manual strategy tester will suit the best."
Then log enough to tell one test from another. Date and time, pair, timeframe, direction, entry, stop, exit and the result in R are the baseline. The fields specific to this indicator are which line gave the signal, which of the three rule versions you used, whether the lines were spread or intertwined at entry, and which bar you read the cross on given the shift.
Which settings suit a 5-minute or intraday chart?
One source publishes settings by timeframe, and they are that author's recommendation rather than a tested result. LiteFinance gives three sets: 13, 8, 5 with shifts 8, 5, 3 for H4 and longer; 21, 13, 8 with shifts 13, 8, 5 for H1; and for a five-minute chart "Jaws period = 34; shift = 21;" down to "Lips period = 13; shift = 8."
Its stated rule behind that is counterintuitive: "the shorter the working timeframe, the greater values should be set for the indicator formula". Slower settings on a faster chart, to cut the noise.
None of those sets has a published test behind it. Treat them as starting points, change one number at a time, and re-run the same pair and the same date range after each change. Changing the period and the date range together tells you nothing about either.
Can you test the Alligator in ChartLabs?
Yes. Williams Alligator is one of the standard indicators, under Standard in the Indicators menu, drawn on price. Our defaults are the standard settings: Length 13 with Offset 8 for the jaw, Length 8 with Offset 5 for the teeth, and Length 5 with Offset 3 for the lips. Each line is a smoothed moving average of the median price, (high + low) / 2, seeded with a simple average, and the offset moves the line forward rather than smoothing it further. Nothing backtests it for you, so the indicator draws the lines and you still place every trade by hand. If you want one of Williams' other indicators next to it, the Awesome Oscillator is in the Indicators menu, and you can add your own custom indicators from there too.
Placing the trades by hand is the point with a rule this loose. You step through real historical candles one at a time and decide, on the bar in front of you, whether the signal fired. A vague rule shows itself immediately: if you cannot tell, it is not written tightly enough yet. Orders are market, limit or stop from a single bar at the bottom of the chart, with stop loss, take profit and risk and reward built in, timeframes go down to one minute, and per-symbol commission and slippage feed every trade's P&L, balances and analytics, which matters here because a crossover rule on a short timeframe fires often enough for costs to decide the outcome. Each moving average takes its own colour and line style, so three lines in three colours stay readable, and your drawings and sub-panel indicators save as you work.
Does the Alligator indicator work?
No published source can tell you. The pages that come up for it carry no win rate, no trade count and no profit factor, and none of them reports what any of the settings above did over any pair or date range. The trending premise behind the whole indicator is uncited as well.
The answer only exists for your own pair, your own written rule and your own sample. One pair, one timeframe, one date range, one rule fixed before the first bar, and enough trades for the result to mean anything: our forex backtesting guide covers how many that takes.
Where does the Alligator fall apart?
In a range, and the sources agree on it. TradingView's limitations section says "the Williams Alligator indicator is known for pushing false positive signals when the three lines are criss-crossing amongst each other", and adds that "too many awakening signals within a large range will most likely fail, and it could end up triggering whipsaws".
The second weakness is lag, and it is additive. The lines are smoothed averages, which lag by construction, and then the shift moves them to the right. You are reading a smoothed value, placed forward, of a price that has already moved.
The Alligator is a trend filter and it reports nothing useful when there is no trend, which is why the sources that are honest about it tell you to pair it with something that says whether a trend is there at all.
Next step
Write one version of the rule down, pick one pair and one date range, and step through it candle by candle before you risk anything on it. ChartLabs has a 7-day free trial, then one plan at $20 a month or $200 a year, no credit card required to start. Start your free trial.
Related reading: forex backtesting, how to backtest a strategy step by step, and manual against automated testing.
Related Topics
Related Guides
Manual vs Automated Backtesting: Which One Should You Use?
Automated backtesting tells you whether a set of rules made money. Manual backtesting tells you whether you can trade them. A practical comparison of what each one tests, what it costs you in time and skill, and which to reach for first.
Backtesting a Trading Strategy: A Beginner's Guide
What backtesting is, why it matters, and how to run one step by step: defining your rules, choosing clean historical data, stepping through the chart trade by trade, logging results, and reading the metrics that tell you whether your strategy has a real edge.
Forex Backtesting: Test Your Strategy on Real Data
A practical guide to backtesting forex strategies: why session dynamics, spread variation, and pair-specific behavior change your results, what clean historical data actually means, and a five-step process for testing a strategy before you risk real capital.