How do I deal with different error messages within an Expert Advisor ?

 
Hello,

I have the created the following code, and wanted to ask if I had dealt with Error codes in the correct way, in relation to order execution. I want to make sure that by using the following code below that I will not get any problems or bugs. Here is the code I am referring to:

  
    if ( Bid > High[1] )

         {							
          
          OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,White); // close position							
          Print("Error Closing Lots1 Sell Order : ",GetLastError() ); 							
          if (GetLastError()==0 || GetLastError()==135 || GetLastError()==138) Sleep(200);       							
          if (GetLastError()!=0 && GetLastError()!=135 && GetLastError()!=138) Sleep(5000);       							
          RefreshRates();							
         
          }	




Is the above code ok ? Or can you see a potential problem occuring with way i have dealt with different errors ?

Thank you in advance. I am always very grateful for your help.

Regards

RJF

 
Please read manual closely
===
The function returns the last occurred error, then the value of special last_error variable where the last error code is stored will be zeroized. So, the next call for GetLastError() will return 0.
===
Reason: