do while loop

Back to topics list To post a new topic, please log in or register
avatar
2
marksimmonds 2015.11.09 05:30
 

I must be going blind.... why does this code cause my MT4 platform to hang? I'm assuming an infinite loop.... but the code looks good to me.... please help....THanks!


#property indicator_chart_window

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{

int b=1;
   do
      {
       Alert(" b=",b);
       b=b++;
      }
   while(b<10);
     
     
return(0);

}

avatar
735
honest_knave 2015.11.09 08:33 #
 

This is your problem:

b=b++;

 

It should be:

b++;

 

or

b=b+1;

 

or

b=++b;


or

b+=1;

 

Back to topics list  

To add comments, please log in or register