Sleep function problem - page 3

 

Try this:

   if(Ticket1 > 0)
      if(OrderSelect(Ticket1, SELECT_BY_TICKET))
        {
         static long closed_order = 0;
         if(OrderCloseTime() > 0 && Ticket1 != closed_order)
           {
            closed_order = Ticket1;
            Sleep(3600000);
           }
        }
 

Or this, if need precisely 1 hours since the order close time:

   if(Ticket1 > 0)
      if(OrderSelect(Ticket1, SELECT_BY_TICKET))
        {
         static long closed_order = 0;
         if(OrderCloseTime() > 0 && Ticket1 != closed_order)
           {
            closed_order = Ticket1;
            long time_elapsed_since_close = 1000 * (long)(TimeCurrent() - OrderCloseTime());
            Sleep(3600000 - time_elapsed_since_close);
           }
        }
 
Samuel Manoel De Souza #:

Or this, if need precisely 1 hours since the order close time:

Realy Thanks friend for u help,,  but the both code does not work

Maybe for u using Sleep() function we should working with GetTickCount() 
 
Samuel Manoel De Souza #:

Or this, if need precisely 1 hours since the order close time:

if i do simpl that .. logically its work normal .. but its does not work !!

and i dont why and where is the probleme??


if ( LastClosed("Type")==OP_SELL )
 
 {    
   Sleep(3600000);
  }
Reason: