Is it possible to set slippages for pending orders in mt4?

Hi,

I think the slippage parameter in ordersend() only works for market orders, right? if I set it when sending a buy_stop, it won’t help when the stop is hit, right? if yes, is there’s a way to protect from slippage when pending orders get hit?

Thank you very much

I’m no expert on MT4 (coding) let me make that clear.

I do know this though:

Even with market orders it depends on your broker as far as I know i.e. at some MT4 brokers (when placing a market order via ‘New Order’) there is an option ‘Enable maximum deviation from quoted price’ (the amount of the ‘maximum deviation’ is user defineable obviously) and at others this option is not offered. So as I said: as to whether the slippage parameter in ordersend() only works for market orders I’d check if it indeed works with you broker.

In addition to the above: at NO broker have I seen the option ‘Enable maximum deviation from quoted price’ available for either stop or limit orders.

Understanding order types and how they are executed is important to know though (if you don’t already understand this that is of course). Here’s a link that contains some information and two further links explaining the different types of (possible) orders and how they are executed (in reality): Technical Trading Systems at TechTraderCentral - Types of Orders.

Not sure if all this helps but slippage is just a ‘part of the game’ and many people don’t understand this (and I’m not particularly referring to you).

Regards,

Dale.

Yes that is correct.

When sending pending orders the slippage parameter in OrderSend() is ignored you should set it to 0.
This is because you selected a price before the market got there, so unlike market orders there can be no slippage. Slippage is when the price changed before the order was received by the broker.

Good morning,

SDC:

You and I have never disagreed on anything but are you 100% sure about this:

This is because you selected a price before the market got there, so unlike market orders there can be no slippage. Slippage is when the price changed before the order was received by the broker.

You probably know this but for those who dont:

A stop order ‘becomes’ or ‘is executed as’ a market order (that’s why I included the links in my post above as this is well detailed and explained). So to use a classic example: let’s take an opening gap (which in FOREX will usually only occur between the close on Friday and the open on Sunday / Monday). Let’s say the EUR/USD closed at 1.4500 on Friday and it opened at 1.5000 (gapped ‘up’) on Sunday / Monday and you happened to have a stop loss order placed at 1.4600. Your stop loss order simply cannot be executed at the open on Sunday / Monday at 1.4600 simply because that price is no longer ‘available’ to the broker (and in this example it really doesn’t matter whether it’s a dealing desk or a non-dealing desk broker i.e. the price at which you placed your stop order just isn’t there anymore). If you’re LUCKY i.e. if you have a reputable broker your stop loss order (in this example) will be executed at the opening price on Sunday / Monday at 1.5000. If you’ve got a ‘bum’ broker, and price keeps going against you, they can (and will) delay the execution of that stop order until price ‘calms down’ after the open and that may be at an even worse price that 1.5000.

And to make matters worse and if you trade with one of those brokers that does INDEED allow YOU to set a ‘maximum deviation’ from the stop order price: if the gap (price) exceeds that ‘maximum deviation’ your stop order will simply be ‘skipped’ or cancelled and you’ll still be in the trade. In this case, and if you’re LUCKY, price will pull back to where your stop order WAS placed but if you’re UNLUCKY the trade could just continue to go against you until you close it manually. And also with a stop order, unlike with a market order, you won’t get a re-quote either!!! In short: when you place a stop order you’re effectively instructing your broker to execute your stop order AT or CLOSEST TO your price specified. There is only one exception to this and that is to use a broker that ‘guarantees’ stops BUT you pay a fee for that (and such fee may or may not exceed the ‘cost’ of the slippage).

Limit orders, on the other hand, are not SUPPOSED to be (able to be) slipped i.e. a ‘true and proper’ limit order basically means to execute the order at a price that is ‘at or better’ than your order price. Using the above as an example: had you placed a limit order sell at 1.4600, and given a decent broker, it would have been executed at 1.5000 which would be known as ‘positive slippage’. But then again: I know of brokers that will simply ‘overlook’ your limit order, cancel it using the ‘price not available’ ‘excuse’ or ‘off quotes’ ‘excuse’ or, and again if you’re LUCKY, will leave your limit order pending until (if???) price comes back down to the price of your limit order.

Needless to say: I’ve used an opening gap (up) as an example but the exact same ‘rules’ appy when trading the news for example i.e. in the case of a huge spike in price for whatever reason if you’re using a market order you will probably be re-quoted and if you’ve placed a stop order it will in all probability be slipped.

Agreed??? Or not???

Regards,

Dale.

Excellent explanation Dale. I have gotten that “off quotes” numerous times. I’ve asked the customer service folks and they just send me some stuff on FIFO violation. Can you recommend a good broker that doesn’t engage in these practices? I am in the US btw.

@issteven, would you be interested in this order functionality if it was available on a different platform from MT4?

@dpaterso, you are correct that the Maximum Deviation functionality on MT4 is limited to market orders.

However, you both may be interested to know that FOREX.com’s Advanced Trading Platform allows you to set a price tolerance on both market orders and pending orders to limit your slippage to the amount of pips you specify.

That said, it’s important to note that if you are using a stop order to cut your losses on an open trade, then accepting some slippage in order to close the trade may be better than leaving the stop order unexecuted with the risk of losing even more money on your open trade.

@hdorey, it seems the “off quotes” message you received is unrelated to the situation Dale described. It’s important to understand that all US-regulated brokers are required to comply with FIFO (first in, first out) order execution rules. Make sure you close your trades in the same currency pair in the same order you opened them, and you should be able to avoid such error messages in the future.