Modify Alligator

 

Hi


I cant find what Ive missed in this coed. Im trying to add another MA to Williams Alligator but it wont compile. I get three undeclared identifiers

What am I missing? THanks + regards /danerius

//+------------------------------------------------------------------+

//|                                           Modified Alligator.mq4 |

//|                                                   Copyright 2020 |

//+------------------------------------------------------------------+

#property copyright   "2020 Danerius"

#property description "Modified Aligator"

#property strict


//---- indicator settings

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1  White

#property indicator_color2  Blue

#property indicator_color3  Red

#property indicator_color4  Lime

x

//---- input parameters

input int InpSlowPeriod=55; // Slow Period

input int InpJawsShift=0;   // Slow Shift

input int InpJawsPeriod=34; // Jaws Period

input int InpJawsShift=0;   // Jaws Shift

input int InpTeethPeriod=21; // Teeth Period

input int InpTeethShift=0;  // Teeth Shift

input int InpLipsPeriod=8;  // Lips Period

input int InpLipsShift=0;   // Lips Shift

//---- indicator buffers

double ExtWhiteBuffer[];

double ExtBlueBuffer[];

double ExtRedBuffer[];

double ExtLimeBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

void OnInit(void)

  {

   IndicatorDigits(Digits);

//---- line shifts when drawing

   SetIndexShift(0,InpSlowShift);

   SetIndexShift(1,InpJawsShift);

   SetIndexShift(2,InpTeethShift);

   SetIndexShift(3,InpLipsShift);


//---- first positions skipped when drawing

   SetIndexDrawBegin(0,InpSlowShift+InpSlowPeriod);

   SetIndexDrawBegin(1,InpJawsShift+InpJawsPeriod);

   SetIndexDrawBegin(2,InpTeethShift+InpTeethPeriod);

   SetIndexDrawBegin(2,InpLipsShift+InpLipsPeriod);


//---- 3 indicator buffers mapping

   SetIndexBuffer(0,ExtWhiteBuffer);

   SetIndexBuffer(1,ExtBlueBuffer);

   SetIndexBuffer(2,ExtRedBuffer);

   SetIndexBuffer(3,ExtLimeBuffer);

   

//---- drawing settings

   SetIndexStyle(0,DRAW_LINE);

   SetIndexStyle(1,DRAW_LINE);

   SetIndexStyle(2,DRAW_LINE);

   SetIndexStyle(3,DRAW_LINE);

   

//---- index labels

   SetIndexLabel(0,"Gator Slow");

   SetIndexLabel(1,"Gator Jaws");

   SetIndexLabel(2,"Gator Teeth");

   SetIndexLabel(3,"Gator Lips");

  }

//+------------------------------------------------------------------+

//| Bill Williams' Alligator                                         |

//+------------------------------------------------------------------+

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 &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

   int limit=rates_total-prev_calculated;

//---- main loop

   for(int i=0; i<limit; i++)

     {

      //---- ma_shift set to 0 because SetIndexShift called abowe

      ExtBlueBuffer[i]=iMA(NULL,0,InpSlowPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);

      ExtBlueBuffer[i]=iMA(NULL,0,InpJawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);

      ExtRedBuffer[i]=iMA(NULL,0,InpTeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);

      ExtLimeBuffer[i]=iMA(NULL,0,InpLipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);

     }

//---- done

   return(rates_total);

  }

//+------------------------------------------------------------------+

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. #property indicator_color4  Lime
    x                                 
    //---- input parameters
    Don't post code that will not compile.

  3. OnInit returns an int.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference
              How to do your lookbacks correctly.
 
Oh. Sorry... Like this?
 
bodanerius:
Oh. Sorry... Like this?

You have edited your post and used the code button, but you have not corrected either of the issues that William has pointed out.

 

Hi.

Removed that random "x" and got a new set of error messages that helped me fix the code enough to compile.

But now the fourth line wont plot on the chart window? Any guidance appreciated

/thanks

 
Post your modified code and highlight line(s) that are giving problems.
 

//+------------------------------------------------------------------+
//|                                           Modified Alligator.mq4 |
//|                                                   Copyright 2020 |
//+------------------------------------------------------------------+
#property copyright   "2020 Danerius"
#property description "Modified Aligator"
#property strict

//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1  White
#property indicator_color2  Blue
#property indicator_color3  Red
#property indicator_color4  Lime

//---- input parameters
input int InpSlowPeriod=55; // Slow Period
input int InpSlowShift=0;   // Slow Shift
input int InpJawsPeriod=34; // Jaws Period
input int InpJawsShift=0;   // Jaws Shift
input int InpTeethPeriod=21; // Teeth Period
input int InpTeethShift=0;  // Teeth Shift
input int InpLipsPeriod=8;  // Lips Period
input int InpLipsShift=0;   // Lips Shift
double ExtWhiteBuffer[];
double ExtBlueBuffer[];
double ExtRedBuffer[];
double ExtLimeBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit(void)
  {
   IndicatorDigits(Digits);
//---- line shifts when drawing
   SetIndexShift(0,InpSlowShift);
   SetIndexShift(1,InpJawsShift);
   SetIndexShift(2,InpTeethShift);
   SetIndexShift(3,InpLipsShift);

//---- first positions skipped when drawing
   SetIndexDrawBegin(0,InpSlowShift+InpSlowPeriod);
   SetIndexDrawBegin(1,InpJawsShift+InpJawsPeriod);
   SetIndexDrawBegin(2,InpTeethShift+InpTeethPeriod);
   SetIndexDrawBegin(2,InpLipsShift+InpLipsPeriod);

//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtWhiteBuffer);
   SetIndexBuffer(1,ExtBlueBuffer);
   SetIndexBuffer(2,ExtRedBuffer);
   SetIndexBuffer(3,ExtLimeBuffer);
   
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   
//---- index labels
   SetIndexLabel(0,"Gator Slow");
   SetIndexLabel(1,"Gator Jaws");
   SetIndexLabel(2,"Gator Teeth");
   SetIndexLabel(3,"Gator Lips");
  }
//+------------------------------------------------------------------+
//| Bill Williams' Alligator                                         |
//+------------------------------------------------------------------+
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 &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int limit=rates_total-prev_calculated;
//---- main loop
   for(int i=0; i<limit; i++)
     {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      ExtBlueBuffer[i]=iMA(NULL,0,InpSlowPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
      ExtBlueBuffer[i]=iMA(NULL,0,InpJawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
      ExtRedBuffer[i]=iMA(NULL,0,InpTeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
      ExtLimeBuffer[i]=iMA(NULL,0,InpLipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);
     }
//---- done
   return(rates_total);
  }
//+------------------------------------------------------------------+

 

Heres the updated code and Ive higlighted the bits that Im pretty sure arent working. I could be wrong though 


/thanks