User login

  

Alligator Indicator

Alligator Indicator

Alligator indicator consists of 3 Moving averages:

Alligator’s jaws (blue line) – 13-period Simple Moving Average built from (High+Low)/2, moved into the future by 8 bars;

Alligator’s teeth (red line) - 8-period Simple Moving Average built from (High+Low)/2, moved by 5 bars into the future;

Alligator’s lips (green line) - 5-period Simple Moving Average built from (High+Low)/2, moved by 3 bars into the future.

How to trade with Alligator Indicator

Alligator indicator helps to determine the presence and absence of a trend as well as its direction.

For an uptrend to be true and valid 3 lines (Jaws, Teeth and Lips) of Alligator indicator must be laid out appropriate way: Jaws at the bottom (blue), then teeth (red), then lips (green) on top.

Opposite for downtrend: jaws on top (blue), teeth (red), then lips below (green).

Elliott wave traders can use Alligator as a helping indicator to identify impulsive and corrective waves: when price trades outside Alligator’s mouth, the impulsive wave is forming, when price trades inside Alligator’s mouth, the corrective Elliott wave is forming.

 

Display/hide source code
//+------------------------------------------------------------------+
//|                                                    Alligator.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"
 
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Lime
//---- input parameters
extern int JawsPeriod=13;
extern int JawsShift=8;
extern int TeethPeriod=8;
extern int TeethShift=5;
extern int LipsPeriod=5;
extern int LipsShift=3;
//---- indicator buffers
double ExtBlueBuffer[];
double ExtRedBuffer[];
double ExtLimeBuffer[];
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- line shifts when drawing
   SetIndexShift(0,JawsShift);
   SetIndexShift(1,TeethShift);
   SetIndexShift(2,LipsShift);
//---- first positions skipped when drawing
   SetIndexDrawBegin(0,JawsPeriod-1);
   SetIndexDrawBegin(1,TeethPeriod-1);
   SetIndexDrawBegin(2,LipsPeriod-1);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtBlueBuffer);
   SetIndexBuffer(1,ExtRedBuffer);
   SetIndexBuffer(2,ExtLimeBuffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
//---- index labels
   SetIndexLabel(0,"Gator Jaws");
   SetIndexLabel(1,"Gator Teeth");
   SetIndexLabel(2,"Gator Lips");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Bill Williams' Alligator                                         |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- main loop
   for(int i=0; i<limit; i++)
     {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
      ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
      ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
12345

Comments