Friday 19 October 2012

slippage works

slippage works when the price moves from the requested entry price.

There are 2 types of order execution on mt4 based brokers. Instant execution and Market execution. You can figure out which you have by going to the open order screen in mt4 and look what it says under "Type". 

Now, typically market execution is for ecn based brokers and instant execution is for MM brokers.

With Instant execution, when you see price and press the buy/sell button you are asking the broker to open your order at that price. Also, you can send a sl and tp with the order request. There is a check box on the order page that says "Enable maximum deviation from quoted price". If you check that and enter a value then that as well is sent with the order request. The broker acknowledges your request and then looks to fill your order. If you didn't sent a max deviation value with the order then you are telling the broker that you only want the price you requested. If that price is not available, the broker sends you a requote with the available price. To which you can accept or reject this and it goes back to the broker and again either gets filled at that price or requoted if the price has moved. Requotes should ONLY occur with instant execution brokers. If you do send a max deviation value with the order, for example 3 pips, then you are telling the broker that you will take a fill at the requested price +/- 3 pips. So if the price moves within that range then your order is filled without a requote. The difference between the initial requested price and the filed price is called slippage. You will notice that there is a setting in FH called slippage. The default is 3. This is the value that is sent with your orders on instant execution brokers. This will prevent a requote if the fill price is within +/- 3 pips from the requested price.

Ok now that is how it should work.. unfortunately I have seen LF requote orders even with a huge slippage value sent with the order. Every time a requote occurs then it is slowing down the order process and since we know the price doesn't stand still very long this could turn into an event that causes you to get a much worse entry than you originally asked for. Generally, these crappy brokers will not requote you if theprice has moved against you nor will they give you positive slippage. They will only requote you or slip you when it hurts your position. This is the sign of a bucket shop broker. Also, this is a built in function of the virtual dealer plugin that is sold as an addon by metaquotes to the brokers.

Now lets go over Market Execution. Incidentally, this is why you have the option in the settings "SupportECN". Because with market execution brokers when you send the order in, you are not sending in the price (nor sl or tp). You are just sending a request to the broker to open your order of a certain size. The broker acknowledges the request and then goes to the liquidity pool to get you the best fill possible. That is at whatever price is available. There is NO requotes since with this type of order you are not sending a requested price but only asking for a fill. The broker then sends you back the price the order was filled at with the order ticket number. If the price is higher than when you hit the buy button then you got negative slippage and if the price moved lower than when you pushed the button you get positive slippage. A good ecn broker should give both positive and negative slippage an over time these tend to wash each other out. A broker like FXCM would charge you the negative slippage while putting and positive slippage in their pockets. This is extremely unprofessional and should be illegal. If you NEVER get any positive slippage then you can bet your broker is doing this. As I said, you should NEVER be requoted on this type of broker cause there is nothing to requote. You only get slipped.

I should add, that with market execution you don't send the TP and SL with the order request but rather after the order has been open you send in an order modify request with the SL and TP.

This is why you see an option in many ea's (including FH) about ECN. So the EA knows how to send in the order request.

Lets look at the FH code for a BUY
if (!SupportECN) 
ticket_4 = OrderSend(Symbol(), OP_BUY, lots_40, Ask, slippage, price_16, price_8, EA_Name + ls_24, MagicNumber, 0, Green);
if you have ecn set to false then it sends the order with the symbol,Buy, lots, ask price, slippage, SL, TP, order comment, Magic number

else {
ticket_4 = OrderSend(Symbol(), OP_BUY, lots_40, Ask, slippage, 0, 0, EA_Name + ls_24, MagicNumber, 0, Green);
Sleep(1000);
OrderModify(ticket_4, OrderOpenPrice(), price_16, price_8, 0, Black);
else if ecn is true then send order as symbol, buy, lots, ask price, slippage ,0,0, comment, magic number

then sleep for a few cycles and send modify to set sl and tp.


now after looking at this is does seem that both market execution and instant execution have slippage control. Maybe my understanding is not correct about how market execution orders are executed or maybe the values are sent just as place holders like 0,0 seen above in the place of sl and tp.

The one thing that has now become clear to me is that FH never does a refresh rates. All ea's should refresh the rates prior to sending in the order so that the ASK/BID is fresh and accurate to the current price. I think I need to add that into this code. That could be why order prices get slipped like they do.