Jump to content

How to Stop trading on server error


APopovA

Recommended Posts

Re: Help Please: How to Stop trading on server error?

 

Please, guys help me out. I need to fine tune an EA so that it would stop trading on any (first) server error(e.g. trading context is busy, or requote). No matter what I do, if I use "while" expression it seems to keep sending order until it is filled...

 

Hi,

 

Good day,

 

Do you mean that you want your EA to stop working when it fails placing orders???

 

if so, you need to add a small code to your EA. It is where it says Print(Trading Context is busy).

 

well, the problem from EA to another it is different so I can't tell how.

 

If it is a private EA, you can PM and will see how to fix it. If you can't, it is fine. I guess I have to place some options and you can change it based on your understanding to it.

 

If there is anything I can do, please let me know as soon as possible.

 

Best wishes,

a New Year 2011 has come, and the challenge has just started 8-)
Link to comment
Share on other sites

  • 2 weeks later...

Re: How to Stop trading on server error?

 

Here is a little function I use that might point you in the right direction.

 

bool fnCheckOrderAllowed()
  {
   int tries = 1;
       
   while(tries < Order_Retries && !IsTradeAllowed()) { tries++; Sleep(Order_Retries_Sleep); }
     RefreshRates();
  
   return(true);
  }

 

I have Order_Retries as an external variable and have it equal to 7 and Order_Retries_Sleep equals 5000

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...