Proper use of the Sleep() function within an EA?

 
Hi Slawa,

Just wondering if I can use sleep function to make EA "wait for 8 seconds" between trading operations, for example:

   If (Bid>High[1]) then Open Order 17;

     Sleep(8000);

        If (Bid<Low[1]) then Close Order 17;



Just want to make sure that if I do this, that it will not cause any problems?

Thanks Slawa. Always appreciate your great help.

With regards

RJF



 
No. Example should be:
   If (Bid>High[1]) then
     {
       Open Order 17;
       Sleep(8000);
       RefreshRates();
     }

   If (Bid<Low[1]) then Close Order 17;
 
No. Example should be:
   If (Bid>High[1]) then
     {
       Open Order 17;
       Sleep(8000);
       RefreshRates();
     }

   If (Bid<Low[1]) then Close Order 17;




Thanks for this Slawa, i now see exactly what you mean. i should refresh rates (ie refresh bid and low[1]) as during the 8 second wait these varibales may have changed. You are certainly a mentor to me. Thanks Slawa !!!!!

kind regards

RJF :-)
Reason: