Simple Loop

 
I know I'm asking for a boot in the head, but it seems as thought the language has changed since I was coding last.  Trying to do a simple loop from 1 to 50, where the code stops at 50.  What I get is: 1 to 50 then continuously loops again from 1 to 50.  I want to stop at 50.  Would appreciate any ideas.  Hopefully no boots.  Thanks!   
int start()
   {
    int n = 51;
while(--n > 0 && n < 51)
{
   Alert("n = ",n);
}                                                   
 
//----
   return(0);
}

I've included a simple code.
 
Yellowbeard1881:
Trying to do a simple loop from 1 to 50, where the code stops at 50.
int OnStart()
   {
    for(int n = 50; n > 0; n--)
       Alert("n = ",n);
    return(0);
   }
 
Ryan L Johnson #:

i hate correcting anyone, but the op wants the loop so that "the code stops at 50", therefore the for loop would be like so, correct?

   for(int i; i<50; i++)
 
Michael Charles Schefe #:
i hate correcting anyone, but the op wants the loop so that "the code stops at 50", therefore the for loop would be like so, correct?

Not to be smug, but where i is less than 50, you only go up to 49 (0─49).

To the extent that I'm incrementing downwardly (50─1) and you're incrementing upwardly, you could be technically correct in that regard.

 
Thanks for your input(s).  int onstart() doesn't seem to be recognized with mql, though it still compiles.   int start() is what works.  The count begins with 0 because the current candle is 0.  for(int i; i<50; i++) does not stop at 50.  It seems that with every tick the loop starts again, even if you want it to stop at a specific number. (50)  The break operator also is ignored.  Trying to create a loop with n=n+1 effects the code as a whole instead of just one loop.  Thanks, again!