Alligator
The Alligator combines three smoothed moving averages to identify trends and their direction.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by line direction/crossovers or the proposed entry price relative to a line. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers 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
| Rule | Long signal is 1 when | Short signal is 1 when |
|---|---|---|
| The Lips rises | Lips rose on the previous bar | Lips fell on the previous bar |
| The Lips falls | Lips fell on the previous bar | Lips rose on the previous bar |
| The Teeth rises | Teeth rose on the previous bar | Teeth fell on the previous bar |
| The Teeth falls | Teeth fell on the previous bar | Teeth rose on the previous bar |
| The Jaws rises | Jaws rose on the previous bar | Jaws fell on the previous bar |
| The Jaws falls | Jaws fell on the previous bar | Jaws rose on the previous bar |
| The Lips crosses the Teeth upward | Lips crossed above the Teeth | Lips crossed below the Teeth |
| The Lips crosses the Teeth downward | Lips crossed below the Teeth | Lips crossed above the Teeth |
| The Lips crosses the Jaws upward | Lips crossed above the Jaws | Lips crossed below the Jaws |
| The Lips crosses the Jaws downward | Lips crossed below the Jaws | Lips crossed above the Jaws |
| The Teeth crosses the Jaws upward | Teeth crossed above the Jaws | Teeth crossed below the Jaws |
| The Teeth crosses the Jaws downward | Teeth crossed below the Jaws | Teeth 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
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| MA method | select | Smoothed | Simple, Exponential, Weighted, Smoothed | Smoothing method of the three lines |
| Apply to | select | Median | Open, High, Low, Close, Median, Typical, Weighted | Price series the lines are calculated from |
| Jaws period | number | 13 | 1 to 1000 | Period of the Jaws line |
| Jaws shift | number | 8 | 0 to 1000 | Bars the Jaws line is shifted forward |
| Teeth period | number | 8 | 1 to 1000 | Period of the Teeth line |
| Teeth shift | number | 5 | 0 to 1000 | Bars the Teeth line is shifted forward |
| Lips period | number | 5 | 1 to 1000 | Period of the Lips line |
| Lips shift | number | 3 | 0 to 1000 | Bars 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.