Jump to content

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

Recommended Posts

Posted
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...
Posted

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-)
  • 2 weeks later...
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

×
×
  • Create New...