I got error on variable already defined . Need help

 

Hi I m new learner in mql4. I got errors while compile the EA. Kindly help to solve the error while in m coding 2 same indicators within same EA:



Upper portion for parameter setting :



input string __________________ = "___________________";

extern string  Separator_06   ="----  Input  Settings Bollinger Bands  ----";

 string Indicator6      = "Bollinger Bands";

input bool UseIndicator6     = false;// Bollinger Band

input ENUM_TIMEFRAMES TimeFrame6 = PERIOD_CURRENT;//Time Frame

input int period        = 20;

input int Shift         = 1;

input double Deviation  = 2;

input ENUM_APPLIED_PRICE ApplyTo = PRICE_CLOSE;

 

input string __________________________ = "____________________";

extern string  Separator__07   ="----  Input  Settings Bollinger Bands  ----";

 string Indicator7      = "Bollinger Bands";

input bool UseIndicator7     = false;// Bollinger Band

input ENUM_TIMEFRAMES TimeFrame7 = PERIOD_CURRENT;//Time Frame

input int period        = 20;

input int Shift         = 0; 

input double Deviation  = 2; 

input ENUM_APPLIED_PRICE ApplyTo = PRICE_OPEN;

 


Bottom portion:-

 

   if (UseIndicator6)

   {

      double BBUpper = iBands(NULL,TimeFrame6,period,Deviation,Shift,ApplyTo,MODE_UPPER,0);

      double BBLower = iBands(NULL,TimeFrame6,period,Deviation,Shift,ApplyTo,MODE_LOWER,0);

      if (Bid >= BBUpper) Indi6 = Sell;

      if (Bid <= BBLower) Indi6 = Buy;     

   }

   if (UseIndicator7)

   {

      double BBUpper = iBands(NULL,TimeFrame7,period,Deviation,Shift,ApplyTo,MODE_UPPER,0);

      double BBLower = iBands(NULL,TimeFrame7,period,Deviation,Shift,ApplyTo,MODE_LOWER,0);

      if (Bid >= BBUpper) Indi7 = Buy;

      if (Bid <= BBLower) Indi7 = Sell;     

   }

 

 

When I compile the EA the error prompt out said “ Variable already defined"


 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

 
Suy Kok Yik:

Hi I m new learner in mql4. I got errors while compile the EA. Kindly help to solve the error while in m coding 2 same indicators within same EA:

When I compile the EA the error prompt out said “ Variable already defined"

input string __________________ = "___________________";

extern string  Separator_06   ="----  Input  Settings Bollinger Bands  ----";

 string Indicator6      = "Bollinger Bands";

input bool UseIndicator6     = false;// Bollinger Band

input ENUM_TIMEFRAMES TimeFrame6 = PERIOD_CURRENT;//Time Frame

input int period1        = 20;

input int Shift1         = 1;

input double Deviation1  = 2;

input ENUM_APPLIED_PRICE ApplyTo = PRICE_CLOSE;

 

input string __________________________ = "____________________";

extern string  Separator__07   ="----  Input  Settings Bollinger Bands  ----";

 string Indicator7      = "Bollinger Bands";

input bool UseIndicator7     = false;// Bollinger Band

input ENUM_TIMEFRAMES TimeFrame7 = PERIOD_CURRENT;//Time Frame

input int period2        = 20;

input int Shift2         = 0; 

input double Deviation2  = 2; 

input ENUM_APPLIED_PRICE ApplyTo = PRICE_OPEN;
 
Vitaly Muzichenko:

Great and thanks. Its help.

Problem solved

 
Suy Kok Yik:

Great and thanks. Its help.

Problem solved

The bottom part required to change by adding "period1" ,"Shift1" and etc or not ?

 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

Opps ! Noted and thanks for the help.