Jump to content

Recommended Posts

Posted

Hi.

I would like to know code used in ea to retry after a requote. Basically ea tries to enter trade once, if there is a request it stops. Would like to have it keep trying (5-10) attempts before stopping

 

Thanks

Posted

After previously reading up on the subject (I am sure I looked at OrderReliable at some point too), this is what I use.

 

extern int Order_Retries = 7;

extern int Order_Retries_Sleep = 5000;

 

bool fnCheckOrderAllowed()

{

int tries = 1;

 

while(tries < Order_Retries && !IsTradeAllowed()) { tries++; Sleep(Order_Retries_Sleep); }

RefreshRates();

 

return(true);

}

 

I call the function looking for a true result to allow the order send

Posted

other ways ...

 

Hi,

 

Good day,

 

Thanks for our members for helping out, and that was a great way on how to use a re-try entry.

 

There are some other ways like:

 

place this code above your Sendorder() function//

while(Retry<5 && !IsTradeAllowed()) {Retry++; Sleep(2000);

 

You can see that the last limit is 5 so you can change it to any number, but you need to know how many tries you need.

 

and this little code has to be set under the Sendorder() function//

 

Sleep (2000);

 

And this code you can choose to set it up at the beginning of your code at Start() function, or on top of your main code:

 

int Retry=0;

 

you can make it:

extern int Retry=0;

if you like.

 

remember that the distance between the number of tries and the fixed number has to meet your needs. I hope this point is clear.

 

There is another way using while function, but it would be a little hard for you to set it up so for now try this one.

 

Good luck,

 

SF

a New Year 2011 has come, and the challenge has just started 8-)

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