How to Set Slippage in mt5

 

Hi every one. if any one can help me , i would be really happy and thankful .

i want to set slippage in mt5 and also i used both order send and ctrade but for both of them there is no option to set the slippage, also i found the function  Mytrade.SetDeviationInPoints() but it still does not control the Deviation 

whatever i write for that function , it still does not respect the max slippage i write.  please help me get out of this . i am working on it for weeks. thanks 

 
Azeez Adekunle Isola: Hi every one. if any one can help me , i would be really happy and thankful . i want to set slippage in mt5 and also i used both order send and ctrade but for both of them there is no option to set the slippage, also i found the function  Mytrade.SetDeviationInPoints() but it still does not control the Deviation .whatever i write for that function , it still does not respect the max slippage i write.  please help me get out of this . i am working on it for weeks. thanks 

You can only set the maximum deviation (slippage) if the broker supports "Instant execution" on that symbol, and that is usually only possible if it is a "dealing desk" account or broker.

However on NDD (non-dealing desk), STP (straight through processing) and ECN accounts, it is usually "Market execution" which does not support limiting deviation (slippage).

Basic Principles - Trading Operations - MetaTrader 5 Help

Types of Execution

Four order execution modes are available in the trading platform:

  • Instant Execution
    In this mode, an order is executed at the price offered to a broker. When sending an order to be executed, the platform automatically adds the current prices to the order. If the broker accepts the prices, the order is executed. If the broker does not accept the requested price, a "Requote" is sent — the broker returns prices, at which this order can be executed.
  • Request Execution
    In this mode, a market order is executed at the price previously received from a broker. Prices for a certain market order are requested from the broker before the order is sent. After the prices have been received, order execution at the given price can be either confirmed or rejected.
  • Market Execution
    In this order execution mode, a broker makes a decision about the order execution price without any additional discussion with a trader. Sending an order in such a mode means advance consent to its execution at this price.
  • Exchange Execution
    In this mode, trade operations conducted in the trading platform are sent to an external trading system (exchange). Trade operations are executed at the prices of current market offers.
Execution mode for each security is defined by the brokerage company.
 
Fernando Carreiro #:

You can only set the maximum deviation (slippage) if the broker supports "Instant execution" on that symbol, and that is usually only possible if it is a "dealing desk" account or broker.

However on NDD (non-dealing desk), STP (straight through processing) and ECN accounts, it is usually "Market execution" which does not support limiting deviation (slippage).

thanks mate

you were the only person who could help me.

cant we use any kind of trick to make slippage a certain value in "market execution " brokers ?

 
Azeez Adekunle Isola #: thanks mate you were the only person who could help me. cant we use any kind of trick to make slippage a certain value in "market execution " brokers ?

Unfortunately not! "Market execution", means accept ANY price the market offers at the time the order is filled.

All you can do is monitor the current prices and spread and execute when the conditions are most favourable, but there is no guarantee.

 

Well if you send a market order with a certain price the server (at least MQ demo account) refuses execution with the error Requote.

In the struct result you can find the actual ask and bid price of the server and then you can decide to resend the request with the new prices or not.

As I said it works on MQ demo accounts.

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Result Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Result Structure
  • www.mql5.com
Trade Request Result Structure - Data Structures - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
@Carl Schreiber #: Well if you send a market order with a certain price the server (at least MQ demo account) refuses execution with the error Requote.

It only gives "Requote" if it is Instant Execution. There are no requotes on Market Execution.

MetaQuotes demo accounts are not a realistic representation of most real broker accounts.

 
Fernando Carreiro #:

It only gives "Requote" if it is Instant Execution. There are no requotes on Market Execution.

MetaQuotes demo accounts are not a realistic representation of most real broker accounts.

?

OrderSend only knows:

Identifier

Description

TRADE_ACTION_DEAL

Place a trade order for an immediate execution with the specified parameters (market order)

TRADE_ACTION_PENDING

Place a trade order for the execution under specified conditions (pending order)

TRADE_ACTION_SLTP

Modify Stop Loss and Take Profit values of an opened position

TRADE_ACTION_MODIFY

Modify the parameters of the order placed previously

TRADE_ACTION_REMOVE

Delete the pending order placed previously

TRADE_ACTION_CLOSE_BY

Close a position by an opposite one


So this TRADE_ACTION_DEAL is an immediate executed market order.

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trade Operation Types - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
@Carl Schreiber #: ? OrderSend only knows:

Please read post #1.

 
Documentação sobre MQL5: Biblioteca Padrão / Classes de negociação / CTrade / SetTypeFilling
Documentação sobre MQL5: Biblioteca Padrão / Classes de negociação / CTrade / SetTypeFilling
  • www.mql5.com
Define o tipo de preenchimento da ordem. Parâmetros filling [in]  tipo de preenchimento da ordem (valor do enumerador...