Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Alligator Mouth Awakening strategy is a trend-following expert advisor (EA) built on Bill Williams' Alligator indicator — a set of three smoothed moving averages — traded as a "sleep-to-awaken" state machine rather than a simple moving-average crossover. The Alligator uses three Wilder-smoothed moving averages (also called SMMA or RMA) of the median price, meaning the average of each bar's high and low. Each line is displaced (pushed forward in time) to create the familiar jaw, teeth, and lips arrangement that Williams likened to a reptile's mouth opening and closing.
The central idea is that markets alternate between coiling (consolidation) and expanding (trending). When the three Alligator lines are intertwined and tightly packed, the "Alligator is sleeping" — there is no directional edge, so the strategy stands aside. When the lines fan out in strict order and the gap between them widens beyond a volatility-based threshold, the "Alligator awakens" — this is the trend-ignition moment the strategy is designed to detect and join. To measure whether the gap is meaningful, the strategy uses the Average True Range (ATR), a common gauge of recent volatility, so the same logic adapts across different instruments and market conditions.
As a learning tool, this strategy is well suited to traders who want to study how trend-ignition filters, indicator displacement, and volatility-scaled thresholds work together. It is best viewed as a structured example of disciplined, rules-based entry timing — a way to understand how a classic indicator can be reframed as a regime-detection system — rather than as a shortcut to any particular outcome.
How It Works
The strategy acts only on freshly closed bars, avoiding intrabar repainting. On each new bar it recalculates the three displaced Alligator lines and the ATR, then evaluates the following logic.
The three Alligator lines:
- Jaw — SMMA(13) of the median price, shifted forward 8 bars (the slow "blue" line).
- Teeth — SMMA(8) of the median price, shifted forward 5 bars (the medium "red" line).
- Lips — SMMA(5) of the median price, shifted forward 3 bars (the fast "green" line).
Awakening conditions (regime detection):
- The mouth is considered open up when the lines fan out in bullish order: Lips above Teeth, Teeth above Jaw, with the fast line on top.
- The mouth is considered open down when the order is reversed: Lips below Teeth, Teeth below Jaw.
- The mouth only "awakens" when the gap between Lips and Jaw exceeds
SeparationAtrMult × ATR— a volatility filter that ignores minor, meaningless separations.
Entry conditions (the strategy signals a trade when the mouth opens this bar):
- Long signal — the mouth opens up on the current bar (it was not open-up on the previous bar), the Lips-to-Jaw gap exceeds the separation threshold, and the closing price is above the Lips line.
- Short signal — the mirror image: the mouth opens down on the current bar, the gap exceeds the threshold, and the close is below the Lips line.
- Only one position per magic number is held at a time, so the strategy does not stack trades.
Exit conditions:
- For a long, the strategy signals an exit when the mouth is no longer open up beyond the exit threshold (
ExitSeparationAtrMult × ATR) — meaning the lines re-entangle or the gap shrinks and the "Alligator is sated" — or when the opposite (down) mouth awakens as a hard reversal. - For a short, the mirror logic applies.
Stop-loss and take-profit logic:
- Every trade is protected with an ATR-based stop-loss, placed
AtrSlMult × ATRaway from the entry price. - Each trade also carries an ATR-based take-profit, set
AtrTpMult × ATRfrom entry. - Because both levels scale with ATR, the protective distances automatically widen in volatile conditions and tighten in calm ones.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| LipsPeriod | 5 | 3 | 13 | SMMA period for the fast "green" Lips line. |
| TeethPeriod | 8 | 5 | 21 | SMMA period for the medium "red" Teeth line. |
| JawPeriod | 13 | 8 | 34 | SMMA period for the slow "blue" Jaw line. |
| SeparationAtrMult | 0.50 | 0.10 | 2.0 | How far the mouth (Lips-to-Jaw gap) must open, in ATRs, to count as "awakening." |
| AtrSlMult | 2.0 | 0.50 | 5.0 | Protective stop-loss distance, measured in ATRs. |
| AtrTpMult | 3.0 | 0.50 | 8.0 | Take-profit distance, measured in ATRs. |
| Lots | 0.10 | 0.01 | 1.0 | Trade volume (position size) in lots. |
The classic Williams displacements (Lips shift 3, Teeth shift 5, Jaw shift 8), the ATR period (14), and the exit separation multiplier (0.20) are exposed as inputs in the source but sit off the main tuning grid, keeping the Alligator faithful to its original design.

Recommended Chart Settings
This EA is designed to run on a single timeframe — every calculation uses whatever chart timeframe you attach it to, so the strategy adapts to your chosen setting. The Alligator originated as a trend-following tool, so instruments and timeframes that produce sustained directional moves — such as major forex pairs like EUR/USD or GBP/USD on the H1 or H4 timeframe — are a sensible starting point for study. Higher timeframes tend to generate fewer but cleaner awakenings, while lower timeframes produce more signals with more noise.
Remember that results will vary significantly across different symbols, timeframes, and market conditions. Always test the strategy on your specific broker's data before drawing any conclusions, because spreads, execution, and price feeds differ between providers.
How to Install on MetaTrader 5
- Download the
AlligatorMouthAwakening.ex5file from the link below. - Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or refresh the Navigator panel.
- Drag the EA onto a chart matching the recommended symbol and timeframe.
- Configure the input parameters and enable Algo Trading.
What to Consider Before Using This EA
Strengths of this approach. By requiring the mouth to open beyond a volatility-scaled threshold, the strategy filters out the whipsaws that plague naive moving-average crossovers during choppy, range-bound markets. The "fresh awakening" condition — acting only on the bar where the mouth first opens — is a deliberate attempt to catch trends near their ignition point rather than chasing them late. Framing the Alligator as a state machine (sleeping versus awakening) gives the logic a clear, teachable structure, and the ATR-based stops and targets keep risk proportional to current volatility.
Known limitations. The Alligator is a lagging, smoothed indicator, and the forward displacement adds further delay to how quickly the lines confirm a new order. In fast reversals, the mouth may open, trigger an entry, and then close again quickly, producing a small loss. Trend-following systems like this one historically struggle in sideways, mean-reverting markets, where repeated false awakenings can lead to a series of small losing trades — a pattern often called "death by a thousand cuts." Because only one position is held at a time, the strategy can also miss re-entries during an extended trend that pauses and resumes.
Where it may underperform. Low-volatility, range-bound conditions and choppy news-driven sessions are the most challenging environments for this design. The separation and exit thresholds are the key tuning levers: setting them too low invites noise, while setting them too high may delay entries until much of a move has already passed. This is a strategy to study and understand, not a set-and-forget solution.
Risk Management Tips
Sound risk management matters far more than any single indicator or entry rule. Consider the following general principles as you study this strategy:
- Position sizing. Keep the
Lotsvalue appropriate for your account size. Larger positions amplify both gains and losses. - Risk a small percentage per trade. A widely taught guideline is to risk no more than 1–2% of your account on any single trade. Because this EA uses ATR-based stops, you can estimate your risk per trade before deciding on lot size.
- Use a demo account first. Test the strategy on a demo or paper-trading account until you fully understand how it behaves across different conditions.
- Understand drawdown. Every strategy experiences losing streaks. Study the maximum drawdown in your own testing so you know what a normal losing period looks like and can stay disciplined through it.
- Avoid over-leverage. Leverage magnifies losses as readily as it magnifies gains. Trade conservatively while you are learning.
- Keep expectations realistic. No strategy wins every trade. The goal of studying an EA like this is to understand its logic and behavior, not to expect any specific result.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: AlligatorMouthAwakening.ex5 (32 downloads)
- Source Code: AlligatorMouthAwakening.mq5 (31 downloads)
- Documentation: AlligatorMouthAwakening.pdf (33 downloads)