Slippage defined in index points

 

I have managed to read this thread: https://www.mql5.com/en/forum/138912 and not know how slippage for the OrderSend() function is defined in index points since it's about currency pairs in there.

For example: with my broker I am able to trade 2 symbols for the german DAX index (or Ger30, if you will).

One is rounded to 1/2 points, so if the price is 13210.0, the next step above would be 13210.5.

The second one allows the price to have 2 digits behind the comma, for example: 13210.23.


How would I define a slippage of 1 index points for both of these?

My assumption is, they have to be defined individually, being 10 for the first example and 100 for the second?

Is that correct? Thank you for the help!

OrderSend() slippage parameter, in points or in pips?
OrderSend() slippage parameter, in points or in pips?
  • 2012.04.08
  • www.mql5.com
I'm pretty sure it's in points, but I want to make absolutely certain! Thanks...
 
ZetaTrader:

One is rounded to 1/2 points, so if the price is 13210.0, the next step above would be 13210.5.

How would I define a slippage of 1 index points for both of these?
  1. Don't talk about "1/2 points." Point is defined in MT as the least quoted digit. (0.1 in your first case.) It could be quoted as 13210.50 and Point would be 0.01. The minimum price change is tick size.
               What is a TICK? - MQL4 and MetaTrader 4 - MQL4 programming forum

  2. Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. I Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
  3. For your index, I'd compute "PIP" starting with tick size, and the slippage is n*pips/_Point
    CHANGE   gPip, gTS;     COUNT    gPipDigits;    COUNT    gPipToPoint;
    bool     compute_pip(void){ // Requires MarketInfo, don't call in OnInit.
       // pip = StringFind(_Symbol, "JPY") < 0 ? 0.0001 : 0.01; // Forex
          MONEY    dvpl  = DeltaValuePerLot();                  // \ +Metals/exotics
          if(dvpl == 0)  return false;
       gTS   = MarketInfo(_Symbol, MODE_TICKSIZE);
       gPip  = gTS;   while(dvpl * gPip < 5)  gPip *= 10;       // / USDMXN/USDZAR
       gPipToPoint = COUNT(gPip / _Point);
       gPipDigits  = COUNT(MathLog10(gPipToPoint) );
       return true;
    }
    
    Note that some brokers do not even use the slippage field.
 
whroeder1:
  1. Don't talk about "1/2 points." Point is defined in MT as the least quoted digit. (0.1 in your first case.) It could be quoted as 13210.50 and point would be 0.01. The minimum change is tick size.
               What is a TICK? - MQL4 and MetaTrader 4 - MQL4 programming forum

  2. Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. I Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum


Thanks for the answer.

I was referring to points as in "index points", i.e. how the index price, in this case the DAX, is commonly measured.

Which, I see now, is different to a "point" as it is referred to in Meta Trader.

If I interpret correctly, in the first example I gave, if I gave the slippage of 20, a buy trade for 13210 would enter at 13212 at worst, higher than that it would not execute. Regarding the second example, the same trade would need a slippage of 200.

So, in other words, 1st example: 1 pip = 10 points, 2nd example: 1 pip = 100 points. And generally, slippage is entered in points.

Correct?

 
William Roeder:
  1. Don't talk about "1/2 points." Point is defined in MT as the least quoted digit. (0.1 in your first case.) It could be quoted as 13210.50 and Point would be 0.01. The minimum price change is tick size.
               What is a TICK? - MQL4 and MetaTrader 4 - MQL4 programming forum

  2. Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. I Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
  3. For your index, I'd compute "PIP" starting with tick size, and the slippage is n*pips/_Point Note that some brokers do not even use the slippage field.

hello master  William Roeder:

I read your links, Codes & try to compute Pip Value for Exotics & Metals like Gold ... But the results seems wrong! for example, the Pip Value of USDMXN should be ~ $ 0.52 not $ 5.2 as  my code' result.
below is the code ... please point me where is the problem? :)

Thank you so much in advance!

regards,

#property strict
#property indicator_chart_window

double LotSize=1;   // Lot Size
double pip;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   string CommentString="";
   string DepositCurrency=AccountInfoString(ACCOUNT_CURRENCY);
   //---
   double dvpl  = DeltaValuePerLot(_Symbol); // \ +Metals/exotics
   pip = MarketInfo(_Symbol, MODE_TICKSIZE);
   while(dvpl * pip < 5)  pip *= 10;         // / USDMXN/USDZAR
   //---
   double PipValue=(DeltaValuePerLot(_Symbol)*pip)*LotSize;  
   //---
   CommentString+="\n" + "Your deposit currency: " + DepositCurrency + "\n";
   CommentString+="Lot size requested: " + DoubleToStr(LotSize,2) + "\n";
   CommentString+="-----------------------------------------------------------------\n";
   CommentString+="Value of one pip    (" + Symbol() + ") : $" + DepositCurrency + " " + DoubleToStr(PipValue,3) + "\n";
   CommentString+="-----------------------------------------------------------------\n";

   Comment(CommentString);

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|  DeltaValuePerLot // https://www.mql5.com/en/forum/109552/page4
//|  DeltaValuePerLot : aCurrencyChange = aPriceChange * OrderSize() * DeltaValuePerLot(). 
//|  The term pip is only defined for currencies, not metals. Analyzing digits or just looking for JPY will not work for 
//|  exotics like USDMXN/USDZAR where the spread is beyond 300 pips. Using Point means code breaks on 4 digit brokers, exotics and metals
//|  For that I've been trying, Compute what a PIP is and use it, not points.                                               |
//+------------------------------------------------------------------+
double  DeltaValuePerLot(string pair=""){
    if (pair == "") pair = Symbol();
    return(  MarketInfo(pair, MODE_TICKVALUE)
           / MarketInfo(pair, MODE_TICKSIZE));
}

 
aphong: But the results seems wrong! for example, the Pip Value of USDMXN should be ~ $ 0.52 not $ 5.2 as  my code' result.

There isn't anything wrong. The whole point of computing a synthetic PIP (not a real PIPs) for mxn is because the spread is over 500 points. 3 Pips for the slippage is irrevalent.

 
William Roeder:

There isn't anything wrong. The whole point of computing a synthetic PIP (not a real PIPs) for mxn is because the spread is over 500 points. 3 Pips for the slippage is irrevalent.

Great! Got it master! ... you re genius :).

Reason: