FFD
From my experience, no order, pending or otherwise should go in without catching the potential for the dreaded 'trade server context busy'
Use something like this to put them on...
//+------------------------------------------------------------------+ //| HandleBrokerOrders.mq4 | //| BD | //| http://www.selectfx.net | //+------------------------------------------------------------------+ #property copyright "BB" #property link http://www.selectfx.net //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int OpenMarketOrder (string strPair, int iOrderType, double dLots, double dPrice, int iSlippage, double dSL, double dTP, string strOrderComment, int iMagicNumber, datetime dtExpiry, color cColour, int iNR, int iMTS) { int iMaxNumRetries, iNumRetries=iNR; // is server or context busy - try n times to submit the order iNumRetries=iNR; while(iNumRetries>0) { int iTicket = OrderSend(strPair, iOrderType, dLots, dPrice, iSlippage, dSL, dTP, strOrderComment, iMagicNumber, dtExpiry, cColour); iNumRetries--; if(iTicket == -1 ) { int iError = GetLastError(); // retry if error is "busy", otherwise give up if( iError==4 || iError==146 || iError==137 || iError==6 || iError==128) //ERR_SERVER_BUSY, ERR_TRADE_CONTEXT_BUSY, ERR_BROKER_BUSY, ERR_NO_CONNECTION, ERR_TRADE_TIMEOUT Sleep(iMTS); else { iNumRetries = 0; Print("OpenAtMarket: OrderSend Error ", GetLastError() ); } } else iNumRetries = 0; } return(iTicket); }
Even pending orders may not get on at busy times!
There is no need for broker discrimination here - any can get busy at any time - usually when you want your EA to pop an order in!
Similarly any OrderClose should get the same treatment.
My Trailing Stops are usually evaluated every tick anyway so I generally use that mechanism to 'keep trying'.
Some daily 'server busy' messages should be expected on a live server & handled in code
My 2c worth
-BB-
Hello BB,
sure enogh, I did something similar but without how many times it wold keep trying.
My idea for this question is not broker discrimination buy to gain knowledge about them. I would be great to have enough money to open accounts at many of them and them compare the execution times, but is not the case and I believe that many people is in it with me.
What about you, do you live trade? I do but in a Java broker and I want to change to a broker with metatrader so it could be automated.
Thanks for your insights anyway and please post your experience.
I live trade, with enough broker experience to know that you just cannot be without some sort of order handling for those busy times (on any broker's server) when some unscheduled news event moves price through resistance AND every indicator signal known to man.
Execution time may indeed vary but so will the tick frequency (a more important factor for many EA's)
--
In terms of broker selection, I would lean towards those countries that require the higher financial standards of the brokers registered in their jurisdiction:-
UK - those under FSA regulation, typically those hosting CFD pension accounts (http://www.selectfx.net/pensions.htm)
USA - recent changes to liquidity requirements
Switzerland - recent changes requiring brokers to meet standards of account protection equivalent to banks
--
On any broker, you should be planning:-
1) For the server to be busy sometime when you need it to take an order
2) For the data feed to be less... friendly to your EA than MetaTrader live or history data
3) To re-optimise the EA when moving to a new account (even from demo to live on the same broker
4) An EA to not perform as well in forward running on a live account as it appears to do on back-testing on that same account
so...
after all that
Good luck in the forex :)
-BB-
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
I would like to know your experience in live accounts about execution time of orders made through an EA.
I'm testing an EA in three different brokers. Two of them no problem so far, the third one is giving me some trouble with a server busy error once in a while, so I wonder how your experiences are in live accounts. How long (in seconds, more or less) wold take for your market orders to be taken? What about the pending orders? And to close them? Trouble with slippage?
If you can give your broker name it will be very usefull, if allowed by the moderator.
Thanks to all.