I guess it depends on broker
as you must know there is a parameter in order send for slippage that you can set it (you can control max accepted slippage by this parameter)
string symbol, // symbol
int cmd, // operation
double volume, // volume
double price, // price
int slippage, // slippage
double stoploss, // stop loss
double takeprofit, // take profit
string comment=NULL, // comment
int magic=0, // magic number
datetime expiration=0, // pending order expiration
color arrow_color=clrNONE // color
[in] Maximum price slippage for buy or sell orders.
but i guess it do not work on Market Execution accounts (brokers) (like ecn accounts), in Market Execution mode order will open at last seen price by broker
but in Instant Execution accounts it should work
hope it helps you
that's right, i believe it will not work on these brokers
Of course, it only works with Instant execution (or Request which is the same right now if I am not wrong).
On "ECN" brokers which use Market (or Exchange) execution, this doesn't work, which is perfectly normal by definition.
In this order execution mode, broker makes a decision
about the order execution price without any additional discussion with
the trader. Sending of the order in such a mode means advance consent to
its execution at this price.
I have a code in my EA that set the slippage. I'm using a ECN broker as claim by the broker. Does that mean I can actually remove that line of code?
Do you think Depth of Market is helpful to avoid large slippage? you can know buy/sell orders nearby the last price, if the volume is large enough so it may avoid bad slippage. but i didn't test it.
This is a very interesting discussion. In my point of view, you have to know beforehand what is the "goal" of the order.
If you want to open a position, then the best thing to do, IMHO, is to use Limit Orders with 0 slippage (as pointed out by HNP2500). If you do this you will NEVER get slippage. In this case, you will face the risk of no execution of your order, but I think a "no execution" is better than a bad execution with high slippage.
However, if the idea is to use the order to stop an ongoing position, then Limit Orders are a very bad idea. In this case, the best thing to do, IMHO, is to use Stop Orders and face the risk of a bad execution with high slippage. The use of Depth of Market is a good idea, however, in high volatile markets (as point out by ROMAN5) it might not work.
Anyway, a very interesting discussion.