Sleep function not working

 

I am trying to write a simple alarm for when an order is closed this is what I have but I can't get it to sleep.

The alarm sounds evey tick and I want it to sound only once after the ordes are closed.


int start()


{ if(OrdersTotal()==0)Alert("Orders Closed!!!");

Sleep(600000);

}

 

two potential issues:

  1. please review how the if statement works. why? what happens when OrdersTotal() > 0 ? iow, the code sleeps regardless of order or no orders
  2. Can only think reason not Sleep(10min) is: Beware below quoted help doc content - incase you doing in an indicator

void Sleep( int milliseconds)
The Sleep() function suspends execution of the current expert within the specified interval.
The Sleep() function cannot be called from custom indicators since they calculate in the interface thread and may not decelerate it.
The checking of the expert stop flag status every 0.1 second has been built into the function.

Parameters:
milliseconds - Sleeping interval in milliseconds.
Sample:
//---- wait for 10 seconds
   Sleep(10000);
 
Reason: