if condition doesn't work properly

 

Hi,

I'm trying to do an if condition but it doesn't work. It always results in condition as candle1=1 even if for each timer I change this variable. Where I'm going wrong?

Thanks in advance

Regards

int candle1=0;

int OnInit()
  {

EventSetTimer(Timer);

//---
   return(INIT_SUCCEEDED);
  }

void OnTimer()
  {

Analize();
}


void Analize()
{
if (candle1=0)
{
Alert("1");
candle1=1; 
}
else if (candle1=1)
{
Alert("2");
candle1=2; 
}
else if (candle1=2)
Alert("3"); 
candle1=3;
}

else if (candle1=3)
{
Alert("4"); 
candle1=4;

}

else if (candle1=4)
{
Alert("4"); 
}
}
 
I'm using mql4
 

= is not a boolean comparison

if (candle1=0)
// Should be
if (candle1==0)

the same in all the if's

 
GumRai:

= is not a boolean comparison

the same in all the if's



Great! Thanks a lot!
Reason: