Forex
EA

EA: Gator Oscillator Trend Expert Advisor

Last updated 2026-07-22

An Expert Advisor (EA) is different from every other download on this site — an indicator only plots or alerts, while an EA actually sends orders on your behalf. This free EA trades a trend-following strategy built entirely on Bill Williams' Alligator and Gator Oscillator working together: the Gator confirms the Alligator has genuinely woken up before any trade is considered, and the Alligator's own line order decides which direction that confirmed trend actually favors.

How the Strategy Works

This EA reuses exactly the entry logic covered in the Gator Oscillator lesson: it requires both of the Gator's histograms — the Jaw-Teeth spread and the Teeth-Lips spread — to be growing on the same bar, which is the mechanical signature of the Alligator's lines actively fanning apart rather than sitting tangled or already fully separated and flattening out. Growth alone doesn't say which direction to trade, so the EA also reads the Alligator's own Jaw/Teeth/Lips order at that same bar: a bullish fan (Lips above Teeth above Jaw) points long, a bearish fan (Lips below Teeth below Jaw) points short. Only when both conditions line up on the same bar — active growth and a clear fan order — does the EA consider an entry, which is deliberately more selective than trading on either signal alone.

Stop Loss, Take Profit, and Position Sizing

Price + AlligatorTake Profit (TP)Stop Loss (SL) = ATR × multiplierBUY0Gator Oscillator: both histograms growing confirms the trend before entry
Entry conditions: BUYwhen both Gator histograms are growing and Lips > Teeth > Jaw — SELL on the mirrored bearish fan — SL and TP are placed automatically from ATR

Unlike the Fractals Breakout EA or Parabolic SAR Trend EA, the Gator Oscillator itself has no natural price level to anchor a stop to — a histogram value isn't a price, so there's nothing on the chart analogous to a broken fractal or a SAR dot to place a Stop Loss against. This EA uses the same ATR-based approach as most other EAs on this site instead: Stop Loss distance is ATRMultiplier × ATR (default multiplier 2.0), recalculated fresh at the moment each trade opens so it automatically widens on volatile pairs and tightens on calm ones. Take Profit is then set at RiskRewardRatio × that same Stop Loss distance (default 2.0), keeping every trade's risk and reward in a fixed, known proportion.

Position size follows the same worked-example method taught in Risk Management Basics: a RiskPercent of account balance (default 1.0%) divided by the ATR-based Stop Loss distance, converted through the symbol's tick value and normalized to the broker's lot step. A UseFixedLot input with a FixedLotSize value is available as an escape hatch for traders who'd rather trade a constant lot size regardless of risk.

Entry Conditions

  • BUY — on the most recently completed bar, both Gator histograms are growing (each larger in absolute value than the bar before it) and the Alligator lines read Lips above Teeth above Jaw.
  • SELL — both Gator histograms are growing and the Alligator lines read Lips below Teeth below Jaw.

The EA evaluates these conditions once per new bar only, tracked against the time of the current bar's open, never on every tick. It opens at most one position at a time, counted and filtered by its own magic number (MagicNumber, default 20260801), so it never confuses a position it opened with one you opened manually or one belonging to a different EA on the same account. Before opening anything, it also checks the current spread against MaxSpreadPoints and skips the entry entirely if the market is too illiquid at that moment.

Parameters

  • JawPeriod / JawShift, TeethPeriod / TeethShift, LipsPeriod / LipsShift (default 13/8, 8/5, 5/3) — the same Alligator settings covered in the Alligator and Gator Oscillator lessons, since this EA's signal is built entirely from those two indicators' shared calculation.
  • MAMethod / AppliedPrice (default SMMA / Median Price) — the smoothing method and price source used by both the Alligator and Gator calculations.
  • ATRPeriod (default 14) — the lookback window for the Stop Loss volatility measurement.
  • ATRMultiplier (default 2.0) — Stop Loss distance = ATR × this multiplier.
  • RiskRewardRatio (default 2.0) — Take Profit distance = Stop Loss distance × this ratio.
  • RiskPercent (default 1.0) — percentage of account balance risked per trade, used to calculate lot size. Ignored if UseFixedLot is enabled.
  • UseFixedLot / FixedLotSize — trade a constant lot size instead of risk-based sizing.
  • MaxSpreadPoints (default 30) — skips new entries while the spread is wider than this, the concern covered in Spread and Slippage.
  • MagicNumber (default 20260801) — tags every order this EA places so its position-counting and management logic never touches trades opened manually or by a different EA.
  • EnableTrading — a master on/off switch, useful for pausing the EA without removing it from the chart.

Why Require Both Growth and Fan Order

It's worth being explicit about why this EA checks two conditions instead of one, since either alone would be simpler to code. Trading on the fan order alone (Lips above Teeth above Jaw, without checking Gator growth) would catch a fan that's already fully established and possibly flattening out — the trend may be mature or even nearing exhaustion by the time the lines settle into a clean order, since the Alligator itself is a heavily lagging, smoothed indicator. Trading on Gator growth alone, without checking which way the fan points, would catch the earliest hint that the lines are separating, but with no information about direction at all. Requiring both together targets a narrower, more specific moment: the Alligator's lines are actively separating (not already separated and stalling) and they're doing so in a confirmed direction. This costs the EA some of the very earliest entries a single-condition system might catch, in exchange for filtering out both stale, already-extended fans and directionless growth that hasn't resolved into a clear trend yet.

Installation and Setup

EAs install into a different folder than indicators — this is the step people miss most often.

  1. Download the file below for your platform.
  2. Open MetaTrader → click FileOpen Data Folder.
  3. Place the file in MQL4/Experts (MetaTrader 4) or MQL5/Experts (MetaTrader 5) — not the Indicators folder.
  4. Restart MetaTrader, then drag the EA from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA will not place any trades while this is off, even if it's attached to a chart.
  6. Review and adjust the input parameters in the EA's settings dialog before confirming.

A Word of Caution

Test on a demo account first, across different market conditions, before risking real money — past performance, in backtests or live, never guarantees future results. No strategy, automated or manual, wins every trade, and this EA can and will lose money on individual trades. Both the Alligator and Gator are lagging by construction, so even a confirmed growing-and-fanned signal is confirming a trend that's already partly underway, not predicting one — entries from this EA will systematically arrive somewhat late relative to the actual turn. A choppy, range-bound market can also occasionally produce a bar or two of apparent Gator growth without a real trend forming, since growth is only ever measured against the single prior bar; consider checking Trend vs Range before enabling it on a live account. Both files are source code — open and review them fully, and understand what every parameter does, before using it. This content is general education, not personalized investment advice.

Download the EA

How to Install — MetaTrader 4

  1. Download the gator-oscillator-trend-ea.mq4 file below.
  2. Open MetaTrader 4 → click FileOpen Data Folder.
  3. Place the file in the MQL4/Experts folder.
  4. Restart MetaTrader 4, then drag the EA from the Navigator window onto the chart.

How to Install — MetaTrader 5

  1. Download the gator-oscillator-trend-ea.mq5 file below.
  2. Open MetaTrader 5 → click FileOpen Data Folder.
  3. Place the file in the MQL5/Experts folder.
  4. Restart MetaTrader 5, then drag the EA from the Navigator window onto the chart.

Both files are source code — open and review the full code before using it, for your own safety.

Download gator-oscillator-trend-ea.mq4

For MetaTrader 4 — this is source code (.mq4), open and review it fully before using it.

Download File

Download gator-oscillator-trend-ea.mq5

For MetaTrader 5 — this is source code (.mq5), open and review it fully before using it.

Download File