Alligator Indicator For MT5
Table Of Contents:
- Alligator Indicator For MT5
- Installing the Alligator Indicator For MT5
- Parameters of the Alligator Indicator For MT5
- Buffers of the Alligator Indicator For MT5
- Main Parts Of The Code
The Alligator Indicator For MT5 is based on the well known trading system developed by Bill Williams. The indicator draws 3 simple moving averages with different periods an colors. The blue moving average has the period 13 and is called the jaw of the alligator. The red line has the period 8 and is called the teeth of the alligator. The green line has the period 5 and is called the lips of the alligator. You can use the indicator to enter into established trends. The experienced trader can also see trend reversals based on the position of the lines.
Installing the Alligator Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file alligator.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the Alligator Indicator For MT5
The Alligator Indicator For MT5 has 8 parameters to configure.
input int InpJawsPeriod=13; // Jaws period input int InpJawsShift=8; // Jaws shift input int InpTeethPeriod=8; // Teeth period input int InpTeethShift=5; // Teeth shift input int InpLipsPeriod=5; // Lips period input int InpLipsShift=3; // Lips shift input ENUM_MA_METHOD InpMAMethod=MODE_SMMA; // Moving average method input ENUM_APPLIED_PRICE InpAppliedPrice=PRICE_MEDIAN; // Applied price
Buffers of the Alligator Indicator For MT5
The Alligator Indicator For MT5 provides 3 buffers.
SetIndexBuffer(0,ExtJaws,INDICATOR_DATA); SetIndexBuffer(1,ExtTeeth,INDICATOR_DATA); SetIndexBuffer(2,ExtLips,INDICATOR_DATA);
Main Parts Of The Code
//| Alligator OnCalculate function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &Time[], const double &Open[], const double &High[], const double &Low[], const double &Close[], const long &TickVolume[], const long &Volume[], const int &Spread[]) { //--- check for rates total if(rates_total lt ExtBarsMinimum) return(0); // not enough bars for calculation //--- not all data may be calculated int calculated=BarsCalculated(ExtJawsHandle); if(calculated lt rates_total) { Print("Not all data of ExtJawsHandle is calculated (",calculated,"bars ). Error",GetLastError()); return(0); } calculated=BarsCalculated(ExtTeethHandle); if(calculated lt rates_total) { Print("Not all data of ExtTeethHandle is calculated (",calculated,"bars ). Error",GetLastError()); return(0); } calculated=BarsCalculated(ExtLipsHandle); if(calculated lt rates_total) { Print("Not all data of ExtLipsHandle is calculated (",calculated,"bars ). Error",GetLastError()); return(0); } //--- we can copy not all data int to_copy; if(prev_calculated gt rates_total || prev_calculated lt 0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; if(prev_calculated gt 0) to_copy++; } //---- get ma buffers if(IsStopped()) return(0); //Checking for stop flag if(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtJaws) lt =0) { Print("getting ExtJawsHandle is failed! Error",GetLastError()); return(0); } if(IsStopped()) return(0); //Checking for stop flag if(CopyBuffer(ExtTeethHandle,0,0,to_copy,ExtTeeth) lt =0) { Print("getting ExtTeethHandle is failed! Error",GetLastError()); return(0); } if(IsStopped()) return(0); //Checking for stop flag if(CopyBuffer(ExtLipsHandle,0,0,to_copy,ExtLips) lt =0) { Print("getting ExtLipsHandle is failed! Error",GetLastError()); return(0); } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+