# Alligator Indicator 0

Posted on 3, March 2014

in Category SID

### Description for Alligator SID 706

The Alligator was developed by Larry Williams. It is a triple moving average indicator.

The logic for this technical analysis indicator:

```#The Alligator was developed by Larry Williams. It is a triple moving average indicator.
my (\$jawperiod,\$jawshift,\$teethperiod,\$teethshift,\$lipsperiod,\$lipsshift,\$ma)=@_;

#Validate the periods
ValidatePeriods(\$jawperiod,\$teethperiod,\$lipsperiod);

#Convert the \$ma parameter to upper-case
\$ma = uc(\$ma);

#Set the default MA.
\$ma = 'SMMA' unless \$ma;

my(\$jaw,\$teeth,\$lips);

#Create the jaws, teeth, and lips columns, based upon on the moving average type.
if (\$ma eq 'SMA')
{

\$jaw = SMA(Ref(MedianPrice,-\$jawshift),\$jawperiod);
\$teeth = SMA(Ref(MedianPrice,-\$teethshift),\$teethperiod);
\$lips = SMA(Ref(MedianPrice,-\$lipsshift),\$lipsperiod);

}
if (\$ma eq 'EMA')
{

\$jaw = EMA(Ref(MedianPrice,-\$jawshift),\$jawperiod);
\$teeth = EMA(Ref(MedianPrice,-\$teethshift),\$teethperiod);
\$lips = EMA(Ref(MedianPrice,-\$lipsshift),\$lipsperiod);

}
if (\$ma eq 'WWS')
{

\$jaw = WWS(Ref(MedianPrice,-\$jawshift),\$jawperiod);
\$teeth = WWS(Ref(MedianPrice,-\$teethshift),\$teethperiod);
\$lips = WWS(Ref(MedianPrice,-\$lipsshift),\$lipsperiod);
}
if(\$ma eq 'SMMA')
{
\$jaw = SMMA(Ref(MedianPrice,-\$jawshift),\$jawperiod);
\$teeth = SMMA(Ref(MedianPrice,-\$teethshift),\$teethperiod);
\$lips = SMMA(Ref(MedianPrice,-\$lipsshift),\$lipsperiod);
}

#Report an error if this moving average does not exist.
die "Invalid moving average \$ma" unless \$ma;

#Rename the columns.
my \$name="iAlligator(\$jawperiod,\$teethperiod,\$lipsperiod)";
SetColumnName(\$jaw, \$name.":jaw");
SetColumnName(\$teeth, \$name.":teeth");
SetColumnName(\$lips, \$name.":lips");

return(\$jaw,\$teeth,\$lips);

#The Alligator Jaw, the Blue line, is a 13-period Smoothed Moving Average, moved into the future by 8 bars;
#The Alligator Teeth, the Red line, is an 8-period Smoothed Moving Average, moved by 5 bars into the future;
#The Alligator Lips, the Green line, is a 5-period Smoothed Moving Average, moved by 3 bars into the future.```