Alligator

The Alligator combines three smoothed moving averages to identify trends and their direction.

Role in the strategy

SlotAvailableRole
Entry PointNo—
Entry RuleYesFilters entries by line direction/crossovers or the proposed entry price relative to a line.
Exit PointNo—
Exit RuleYesTriggers exits by the direction of a line or a line crossover.

The Alligator produces conditions, not order prices. As an entry rule it is ANDed with the entry point and the other entry rules; as an exit rule it is ORed with the other exit rules. See Indicators for the slot semantics.

Logic rules

RuleLong signal is 1 whenShort signal is 1 when
The Lips risesLips rose on the previous barLips fell on the previous bar
The Lips fallsLips fell on the previous barLips rose on the previous bar
The Teeth risesTeeth rose on the previous barTeeth fell on the previous bar
The Teeth fallsTeeth fell on the previous barTeeth rose on the previous bar
The Jaws risesJaws rose on the previous barJaws fell on the previous bar
The Jaws fallsJaws fell on the previous barJaws rose on the previous bar
The Lips crosses the Teeth upwardLips crossed above the TeethLips crossed below the Teeth
The Lips crosses the Teeth downwardLips crossed below the TeethLips crossed above the Teeth
The Lips crosses the Jaws upwardLips crossed above the JawsLips crossed below the Jaws
The Lips crosses the Jaws downwardLips crossed below the JawsLips crossed above the Jaws
The Teeth crosses the Jaws upwardTeeth crossed above the JawsTeeth crossed below the Jaws
The Teeth crosses the Jaws downwardTeeth crossed below the JawsTeeth crossed above the Jaws

Line comparisons use the previous bar's values.

Six entry-only rules compare the proposed Entry Point price with a named line: The position opens above/below Lips, The position opens above/below Teeth and The position opens above/below Jaws. Both directions use that same line and reverse the inequality for shorts. The comparison is strict with a half-point dead zone, and the line is read at the slot's offset (the previous closed bar, or the current bar on an open-price line) with each MA's own plot shift.

Parameters

ParameterTypeDefaultRangePurpose
MA methodselectSmoothedSimple, Exponential, Weighted, SmoothedSmoothing method of the three lines
Apply toselectMedianOpen, High, Low, Close, Median, Typical, WeightedPrice series the lines are calculated from
Jaws periodnumber131 to 1000Period of the Jaws line
Jaws shiftnumber80 to 1000Bars the Jaws line is shifted forward
Teeth periodnumber81 to 1000Period of the Teeth line
Teeth shiftnumber50 to 1000Bars the Teeth line is shifted forward
Lips periodnumber51 to 1000Period of the Lips line
Lips shiftnumber30 to 1000Bars the Lips line is shifted forward

Calculation

The three lines are moving averages of the selected price series with the selected method (tech.movingAverage in engine/indicator-engine/tech.ts), each shifted forward by its own Shift value:

  • Jaws: slowest line (period 13, shift 8) — blue.
  • Teeth: middle line (period 8, shift 5) — red.
  • Lips: fastest line (period 5, shift 3) — lime.

The three lines are drawn on the main price chart.

Backtesting

  • The rule is evaluated on the previous (closed) bar with the standard dead zone (SIGMA = 0.000001).
  • The indicator contributes only long/short signal arrays — it never changes the entry or exit order price.
  • An entry happens only when the entry point allows the direction and every entry rule passes; an exit happens when the exit point is reached and any exit rule passes.