Skip to main content

In this article, we’re excited to share the Alligator Bands Amibroker AFL Code with you. You can download this code at no cost and seamlessly integrate it into Amibroker.

Alligator Bands: A Technical Analysis Primer

The Alligator bands, a creation of renowned trader and author Bill Williams, are a powerful technical analysis tool. They include three distinct lines laid over a price chart – known as the jaw, teeth, and lips. These lines play a crucial role in pinpointing potential shifts in market trends and trading signals.

Here’s a breakdown of the Alligator bands:

  • Jaw (Blue Line): Represented by a 13-period simple moving average (SMA), the jaw is the slowest line and helps in identifying long-term trend directions.
  • Teeth (Red Line): An 8-period SMA, the teeth line stands for intermediate trends and assists in determining the direction over the medium term.
  • Lips (Green Line): The quickest of the three, this 5-period SMA, known as the lips, aids in recognizing short-term trend movements.

The Alligator bands are significant because they equip traders with the ability to spot potential trend shifts and trading opportunities. When these three lines entangle and move closely, it signifies a consolidating or ranging market. On the other hand, diverging lines can indicate the emergence of a new trend.

A popular approach to using the Alligator bands is seeking “crossovers” between the lines. For instance, a bullish trend might be signaled when the lips cross above the teeth, and the teeth cross above the jaw. Conversely, a bearish trend might be indicated when the lips cross below the teeth and the teeth below the jaw. For stronger confirmation, traders often combine these signals with other technical indicators or price action patterns.

Also Read: Acceleration Bands AFL Code

				
					//------------------------------------------------------
//
//  Formula Name:    Alligator Bands
//  Website:         https://zerobrokerageclub.com/
//------------------------------------------------------

_SECTION_BEGIN("Alligator Bands");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( Close, "Price", colorWhite, styleCandle );

// Define Alligator bands parameters
period_jaw = 13;
period_teeth = 8;
period_lips = 5;

// Calculate Alligator bands values
jaw = ma(close, period_jaw);
teeth = ma(close, period_teeth);
lips = ma(close, period_lips);

// Plot candlestick chart
Plot(C, "", colorBlack, styleCandle);

// Plot Alligator jaws
Plot(jaw, "Jaw", colorBlue, styleThick);

// Plot Alligator teeth
Plot(teeth, "Teeth", colorRed, styleThick);

// Plot Alligator lips
Plot(lips, "Lips", colorGreen, styleThick);


_SECTION_END();
				
			

Snapshot of Alligator Bands Amibroker AFL

Have a look at the AFL’s screenshot below

Alligator-Bands-Amibroker-AFL

Explaining the AFL Code

  • Initially, we set the parameters for the Alligator bands, defining the periods for the jaw, teeth, and lips.
  • Then, we calculate the respective values for these lines using the ma (simple moving average) function, which uses the closing prices and their specific periods.
  • Finally, we use the Plot function to display the Alligator jaws, teeth, and lips on the chart. We define each line’s color with colorBlue, colorRed, and colorGreen and set their thickness using styleThick.

Also Read: Keltner Band Trading System: Amibroker AFL