two potential issues:
- please review how the if statement works. why? what happens when OrdersTotal() > 0 ? iow, the code sleeps regardless of order or no orders
- 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 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);

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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);
}