Limit Orders - page 2

 
Hristo Stilyanov:

Hello guys,

I have a question about limit orders in both MT4 and MT5. Do they guarantee an execution price equal or better than the limit price or the broker just convert the limit orders into market orders when the price touches the limit level the same way it does with stop orders?

Looking forward to your answers

I control slippage in MT4 by expert advisor. It checks the slippage and then open the position. MT5 is better and quicker.
 
Kathir A #:
I control slippage in MT4 by expert advisor. It checks the slippage and then open the position. MT5 is better and quicker.

Can you share with us how exactly you control the slippage with your EA?

 
Hristo Stilyanov #:

which broker do it properly?

I'm going to broaden this out slightly.

If you are trading on a stock exchange such as the NYSE then your limit order sits on the central book of the exchange and is filled according to various precedence rules, almost always equal-or-better. But fx is an OTC market, with brokers sending orders to multiple venues, and that changes the meaning of the word "properly".

Taking, as an example, the broker which I have spoken with most recently today, not particularly big or particularly special in any other way, their price on fx majors and minors is backed by nine LPs (and by five to seven on exotics). If you place a limit order with them, there are - theoretically - two choices. Either the broker executes your limit order at market when touched, choosing the best LP at the time, or, in advance, they select one of the LPs and give the limit order to them.

In the latter case, it's possible for your order to be filled on an equal-or-better basis. But that doesn't mean that you get the best possible price. Let's say that, in advance, the broker gives your limit order to LP #7, who fills it equal-or-better. But it's equally possible that, at the time of the fill, another LP such as #5 has a better price, and that you would have got a better fill by having your limit order treated as a market order when touched.

In a decentralised market, there is a conflict between interpreting "properly" as "guaranteed price" versus "likely best price".

 
Hristo Stilyanov #:

Can you share with us how exactly you control the slippage with your EA?

In MT4, I did it myself - in the limit order in the stop loss field, I wrote the opening price of a limit order with a constant offset.

Example for BuyLimit (OrderModify):

#define PRICE_OFFSET 10000

/*
if (OrderType() == OP_BUYLIMIT)
{
  double PriceOpen; // New Value.
  
  OrderModify(Ticket, PriceOpen, PriceOpen - PRICE_OFFSET * _Point , OrderTakeProfit(), 0);
}
*/

if (OrderSelect(Ticket, SELECT_BY_TICKET) && OrderCloseTime())
{
  const double PriceOpen = OrderOpenPrice();
  const double PriceOpenRequest = OrderStopLoss() + PRICE_OFFSET * _Point;
  
  const double Slippage_Open = PriceOpenRequest - PriceOpen;
  
  OrderPrint();
  Print("Slippage_Open = " + (string)Slippage_Open);
}
Reason: