The alligator indicator follows the original recipe closely. Three smoothed averages run over the bar median rather than the close, at 13, 8 and 5 bars. The chart displaces each line forward. A mark appears on the first bar where the three finally line up in order.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 5: Jaw, Teeth, Lips, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 13 |
What the Alligator Indicator draws on the chart
Jaw is the blue line, smoothed over `JawPeriod` bars.
Teeth is the red line in the middle at `TeethPeriod` bars.
Lips is the lime green line at `LipsPeriod` bars.
Buy and Sell mark the first bar of a stack, `ArrowOffsetPoints` from the candle.
- Jaw: line, blue, width 2
- Teeth: line, red, width 2
- Lips: line, lime green, width 2
- Buy: arrow, lime, width 4, arrow code 233
- Sell: arrow, red, width 4, arrow code 234

How the Alligator Indicator calculates its values
Smoothing the bar median
iMA runs with MODE_SMMA on PRICE_MEDIAN, which is high plus low over two. Using the median rather than the close means a bar with a wild close moves the lines less. Smoothed averaging then gives each line its slow, rolling shape.
Displacing the lines forward
`JawShift` `8`, `TeethShift` `5` and `LipsShift` `3` push each plotted line to the right. The displacement affects the display only, so the value sitting over the current candle comes from a bar some way back.
Detecting the stack
bull_now needs Lips above Teeth and Teeth above Jaw on the current bar. bull_prev checks the bar before. A mark prints only when the order became correct on this bar, which turns a state into an event.
How to read the signals
Three lines braided together mean no trend worth trading.
A widening fan in the right order is the stack forming.
The mark lands on the first bar of the stack, which is not the best entry.
Lips closing back on Teeth is the earliest sign the stack is breaking.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
The alert block sits behind `EnableAlerts`, which starts on, and `EnablePopup` carries the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` begin false. `SoundFile` picks the clip. The stack test reads two completed bars, so one message follows each closed bar.
Every Alligator Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
JawPeriod |
Slow line length, default `13`. | 13 |
JawShift |
Forward displacement of the slow line, default `8`. | 8 |
TeethPeriod |
Middle line length, default `8`. | 8 |
TeethShift |
Forward displacement of the middle line, default `5`. | 5 |
LipsPeriod |
Fast line length, default `5`. | 5 |
LipsShift |
Forward displacement of the fast line, default `3`. | 3 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPoints |
Mark distance from the candle in points, default `40`. | 40 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master switch for the stack alerts, default `true`. | on |
EnablePopup |
Terminal dialog once the three lines stack, default `true`. | on |
EnablePushNotify |
Phone push once they stack, default `false`. | off |
EnableEmail |
Mail delivery once they stack, default `false`. | off |
EnableSound |
Sound playback once they stack, default `false`. | off |
SoundFile |
Wav clip for the stack alert, default `alert.wav`. | alert.wav |

Settings that fit your chart
Smoothed median averages suit charts where a trend gets room to develop. EURUSD H1 is the reference chart, where `JawPeriod` `13` covers half a day. On M5 the three lines braid and separate constantly. On H4 and daily a stack holds for long stretches, which is what the design expects.
When the Alligator Indicator fails
Smoothed averaging lags heavily. The stack confirms well after a move begins.
A range braids the lines and produces marks in both directions.
The median source ignores where a bar closed, which can hide a decisive candle.
Copy the compiled Alligator Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.
Download the Alligator Indicator for MT4 and MT5
The zip holds the compiled Alligator Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.
Download this indicator free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
Why does JawPeriod average PRICE_MEDIAN?
Because the original definition uses the bar midpoint. High plus low over two ignores where the candle closed, which keeps a single volatile close from dragging the lines. It also makes the three curves smoother than close-based versions of the same lengths.
What do JawShift, TeethShift and LipsShift do?
They displace each plotted line forward on the chart, by `8`, `5` and `3` bars. That staggering is what makes the fan open up visibly when a trend starts. The values above the current candle come from a calculation a few bars back.
When does the Buy arrow print?
On the first bar where Lips sits above Teeth and Teeth above Jaw, having not been in that order on the bar before. The code checks both bars, so the mark records the formation of the stack rather than every bar it holds.
Is ArrowOffsetPoints at 40 too far on EURUSD?
It is a wide gap, and deliberately so. Three lines already crowd the candles, and a mark tucked against the bar disappears among them. Lower it if you run the tool on a clean chart with nothing else drawn.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Alligator Indicator as one input. Always backtest before trading live.
Category: this is part of our Trend collection. Also, still, yet, still, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- Learn more about the underlying method in ialligator (ALLIGATOR) at the MQL5 Documentation.
- For wider market background, see Alligator at StockCharts ChartSchool.
