Slippage Management (advanced) Question

 

Hi all,

Can anyone provide an in-depth view on the way slippage is handled by MT?

I'll explain:

I was under the impression that when an EA submits an order with a certain slippage, this order is then dispatched to the broker's server as is and the slippage is managed on the server side (successful or not).

However, a correspondence I just had with a broker seems to imply otherwise. According to the below snapshot, apparently taken from the broker's log, it seems like the "dealer" is confirming the slippage with the MT client and that implies that the slippage is client-based.

Which is the case?

(A few details about the snapshot: This is an OrderClose for a EURUSD with a slippage of 12 pip sent only once from an EA at 20:22:12.

Apparently the entities in this log are 917: "the dealer" and 12879: "the account"

The execution delay is horrible, but that is not the case - I'm just trying to understand what is the flow of events )

Thanks for you help,

Roy

 

It looks to me like u specified slippage = 12 points instead of 12 pips (=120 points for EURUSD at 5 digit broker). Your request was at 1.31050 but price changed to 1.31160 (the difference is within 12 pips slippage, but not within 12 points slippage), hence the server sent a requote at that price which was accepted by you (I am guessing this is manual trading...?).

Edit: Slippage is most certainly handled server-side, otherwise it wouldn't exist (it would be identical to a requote...) <- not sure about this.

 

Gordon thanks for you reply.

First and most important - I assure you that this was not a manual trade, but rather an EA order which was sent only once.

Second - I did send the order with 12 points slip but I believe that although the broker shows 5 digits, it's merely a display issue and in fact this is actually a point==pip case - therefore there's no problem with the execution in this case.

In any case what bothers me in the "dealer"'s output is the 4th row of the log showing a "returned for confirm", followed subsequently by (5th row) another "request from 12879..." and then a confirmation.

Each of these cycle takes a sizeable amount of time, hence my assumption that this takes a roundtrip to the MT-client.

I'm attaching here a slightly different snippet of a previous OrderClose - also sent from an EA, again showing (in a the different manner than the first example) what seems to be like a double call from the MT-client to the server - even though I can assure you that our EA code only sent the order once.

Can you try to explain these prints?

Are you confident about your answer regarding the slippage being server-side?

I appreciate your assistance.

Thanks,

Roy

 

Your interpretation of the chain of events, roy650, is how I read it as well. For whatever reason it appears that your broker requires your client-side terminal to confirm an order as if it were a requote even though you have specified the slippage in ordersend.

Have you proposed this line of inquiry to the broker? What was their explanation for the log events?

 
roy650:

[...]

Can you try to explain these prints?

Are you confident about your answer regarding the slippage being server-side?

Well, u made me question my own understanding of MT4 Slippage. Technically, slippage is also checked Client-Side with the quotes in the price thread but my understanding was that it's just a pre-check of our request; with a properly designed EA the request would always be sent with the absolute latest quote received and so slippage is irrelevant. This part is documented both in the docs and in the book.

My understanding of Slippage was that it's ultimate goal is to allow a deviation from our requested price if the price changed at the time the request reached the server (and obviously this price quote would not be in the price thread at the time we made the request). Since in most other platforms this is implemented Server-Side and it makes no sense to do it Client-Side anyway, I assumed it's like so in MT4. Unfortunately, I can't find a single mention of this in the documentation/book/manual or articles.

I find it hard to believe that I have never noticed this if indeed it's not Server-Side, but then I wasn't looking for anything, so it's possible... Don't have much time to look into this right now so I'd appreciate if u report your findings here.

 
1005phillip:

Your interpretation of the chain of events, roy650, is how I read it as well. For whatever reason it appears that your broker requires your client-side terminal to confirm an order as if it were a requote even though you have specified the slippage in ordersend.

Have you proposed this line of inquiry to the broker? What was their explanation for the log events?


Phillip hi,

The intial response from the broker was what alerted me in the first place... Regarding the 1st image I posted they wrote this:

"For order #2570531, ‘12879’ requested to sell one lot EURUSD at 1.3105, and this request was rejected due to incorrect price, the price was not actual market price. So dealer ‘917’ returned a quote - sell EURUSD at 1.31160, as we can see, ‘12879’ also confirmed and completed to this order at 1.3116"

Regarding the 2nd image they wrote:

"On the December 1st 2010, ‘12879’ requested to sell EURUSD at 1.3106, but the actual market price of EURUSD was 1.3112, so ‘sell EURUSD at 1.3106’ was instantly rejected. After that, your Expert Advisor (EA) automatically adjusted the price from 1.3106 to 1.3112, and opened the deal #2570530"

(emphasizes are mine)

Anyway - I wrote back with basically the same question that I posted here and I'm still awaiting their reply.

 
gordon:

...

I find it hard to believe that I have never noticed this if indeed it's not Server-Side, but then I wasn't looking for anything, so it's possible... Don't have much time to look into this right now so I'd appreciate if u report your findings here.


I also find it very hard to believe that the slippage is client-side managed, but this broker's reply was very confusing...

Anyway - We're now running a test to try to isolate this phenomena. Hopefully we'll come to a conclusive results, which I'll surely post here.

 

Well... We just went over the results of the test we ran last night regarding this issue.

We ran 2 sessions sending hundreds of orders with to a single demo broker.

In the first sesssion we used a positive slippage and in the second we used zero slippage.

It's very hard to deduce from such a test due to various reasons - mainly the fact that it's a demo account and also because the volatility of the symbols was mostly low, therefore the slippage was rarely utilized (less than 10% of the orders utilized the slippage).

In any case - the bottom line is that we don't see any pattern to indicate a difference between the 2 sessions that we ran -

therefore it seems like Gordon's initial assumption is indeed correct - the slippage does seem to be server-based (and probably the broker's support is a bit lame in its ability to explain the chain of events...)

Just another quick follow-up question:

Is there a difference between the way each broker's MT server/client behaves?

I mean, I assume that each broker has his own "plug-ins", but as far as the basic functionality goes - do they all use the same "engine" under the hood?

 
roy650:

[...] We ran 2 sessions sending hundreds of orders with to a single demo broker. [...]

I have done similar experimentation in the past with a different aim - to quantify the differences between Demo and Live servers. I'll quote form a previous post (https://www.mql5.com/en/forum/123334):

My conclusions at the time where that there are differences in prices and incoming ticks. Differences in account properties (Accountxxx() functions) and market information (MarketInfo() functions). There are huge differences in timing, demo servers being 2-4 times faster in processing any orders. Demo servers also have almost no re-quotes and no slippage and generally u r almost always filled instantaneously with no problems. This does not happen in a live account.

On the other hand I found that Demo servers tend to have a lot of downtime and disconnections as opposed to live servers which are usually very reliable in that regard.

So I am not sure if testing on a Demo server is the best approach since most of them seem to distort real trading dynamics and behave in an 'idealized' fashion...

Is there a difference between the way each broker's MT server/client behaves?

I mean, I assume that each broker has his own "plug-ins", but as far as the basic functionality goes - do they all use the same "engine" under the hood?

The basic functionality is supposed to be the same. Brokers that use certain bridges ignore the slippage parameter and just guarantee the 'best available price' (which to me always suggested that Slippage is indeed implemented Server-Side for the brokers who do use Slippage), but I find it hard to believe that the Server API would allow a broker to change this type of basic functionality... I mean assuming the Terminal is designed to have Slippage handled on the Server-Side, how can any code on the Server-Side API change the basic functionality of the Client-Side Terminal??? So they probably can't change that.

 

I agree with your conclusions. Also, thanks for your insight on demo testing.

Off topic - I understand from your answers that you're not a meta-quotes rep, right? So, who do you represent? :-)

 
roy650:

I agree with your conclusions. Also, thanks for your insight on demo testing.

Off topic - I understand from your answers that you're not a meta-quotes rep, right? So, who do you represent? :-)

That's correct. I am just another user in the forum, not associated with MQ in any way (see here -> https://www.mql5.com/en/forum/126815). The 'Moderator' status also does not imply anything about my knowledge or experience in MQL4 or Forex in general - most things I say are under the status of 'AFAIK' and 'IMHO' even when I don't specifically mention it. As for whom I represent, myself I guess.

Reason: