[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1071

 
eddy:
that's what it's for, that's why it's in if()
Yes, but you go into a loop and, if the condition is not met, you never get out of the loop with your code construction, it becomes infinite and is not interrupted. You can't see what the sec! parameter is, it's not declared.
 
eddy:
int sec=Seconds();

how is it not declared?:)

the cycle must be interrupted when the second changes

 
eddy:

how is it not declared?:)

the cycle must be interrupted when the second changes

Declared sec, but sec! (with an exclamation mark) ?
 
!=
it's "not equal"
 
eddy:
is "not equal".
sec will always be equal to Seconds(), because the latter is a constant and you assign the value of the constant to "sec".
 
this loop in init(), sec declared in the same place
 
Where are the "Alert" messages stored and until when? Is it possible to read them not in the "Signal" window, but by opening the place where they are located in the terminal (there are times when the window is closed when you switch to another application and you have to start the Expert Advisor again to see it, which is inconvenient) ?
 

Why does this code work fine for one dc, but for another OrderModify error 4051 (invalid ticket)?

 void Modify ()
      int total = OrdersTotal();
      for(int i=total-1;i>=0;i--)
      {
       OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
       if   (OrderModify (OrderTicket(),OrderOpenPrice(),
            OrderOpenPrice()-NormalizeDouble(300*Point,Digits),
            OrderTakeProfit(),0,CLR_NONE)== false)
         {
          Modify();
         }
       }
 
         int sec=Seconds();
       while(true)
         if(sec!=Seconds()) break;   // new sec

Why isn't the cycle interrupted?

 
eddy:

why the loop is not interrupted?

try while (false)

the loop will run as long as sec!=Seconds()

or like this

while(true)

if(sec==Seconds()) break; // new sec

Reason: