sleep() function doesn't work in my expert!

 
I’m trying to get my expert to sleep after a loss trade,
For some reason it doesn't work.

I’ve already checked that the proper order was selected.

The script looks like this:

int i=HistoryTotal();
OrderSelect(i,SELECT_BY_TICKET);
if(OrderProfit()<0)
{
Sleep(900000);
}
If any one has experience with this function and has an idea what the problem is I’d appreciate your kind help!
 
   int i=HistoryTotal();
   if(OrderSelect(i-1, SELECT_BY_POS, MODE_HISTORY)==true)
     {
      if(OrderProfit()<0)
         Sleep(900000);
     }
 
   int i=HistoryTotal();
   if(OrderSelect(i-1, SELECT_BY_POS, MODE_HISTORY)==true)
     {
      if(OrderProfit()<0)
         Sleep(900000);
     }




Thanks Slawa, unfortunately this didn't help.
After debugging my EA I can say for sure that the proper order is selected yet the sleep function has no effect.
Could there be a problem with the sleep function? (Maybe there is a problem with sleep() in the strategy tester?)

I'm using the AL Trade: Meta Trader 4.00 Build 193
 
Regarding Strategy Tester read "Testing Features and Limits in MetaTrader 4" please.
Reason: