confused - MODE_POINT, Point, Pips, 4/5decimal

 

I am able to get my EAs working on any pair 3,4,5 decimal places but it would appear that I thought I understood this but obviously i dont!!! as i play with each to get it correct on any provider or currency pair.

Life is easier if you know what you are doing and it appears it can be done in one way for all possible combinations SO HELP!!!

Why do we need to take into account the difference between 3,4 and 5 decimal places by using if (digits ==3||digits ==5) Point = 10 else Point = 1.

I thought MarketInfo(Symbol(),MODE_POINT) did this for you in all cases?

What is the difference between MODE_POINT and just Point if any other than the chart your EA is on?

and finally what is the difference between point and pips?

 

Why do we need to take into account the difference between 3,4 and 5 decimal. To Standardize what we mean when we say 10 or 20. Now did I mean Points or Pip? One example would be Slippage. The OrderSend() function treats the value you pass to Slippage as Points. For the sake of simplicity, I try to perform allot of my actions in Pips. If I assigned the value of 2-Pips (without using a Standard) in my OrderSend function. It'll mean 2-Pips for a 4-Digit Broker but 2-Points for a 5-Digit broker. On a 5-Digit broker, that'll just be too small. Vice-Versa, If I was used to using a 5-Digit Broker and entering Slippage as 20. When I convert to a 4-Digit Broker, 20-Pips will just be too much for slippage. Using 2*Point2Pip{Where Point2Pip is the Standardizer} then I know I'm always gonna get 2-Pips. On 4-Digits Brokers it's going to translate as 2*1=2. And for 5-Digits Brokers it's going to translate as 2*10=20.

I thought MarketInfo(Symbol(),MODE_POINT) did this for you in all cases? Yeah, until you try to built a Multi-Currency Strategy which works on a Single Chart like the ones submitted to the Automated Championship. In that case I use MarketInfo(iSymbol_,MODE_POINT){Where iSymbol_ can be changed from "EURUSD" to "USDJPY" etc}

And finally what is the difference between point and pips? A Pip is Traditionally a Standard. Human beings like to categorize things so that we can understand it better. As such a Pip is like a Share{in Stocks}, A-Foot{in Measurement}, A Gallon{of Gas}. The list goes on. It used to be the smallest Unit of Transaction on Forex, like a Penny is the smallest unit of measurement for a Dollar. Which I believe was 100,000 Units of the Base-Currency. But just like probably at one point A-Foot had to be broken down to Inches, so too did Pip have to be broken down to Points. On 4-Digits Quoits {EURUSD}, a Pip is 0.0001. On 2-Digits Quoits {USDJPY}, a Pip is 0.01. It's the Number of digits on the right side of the decimal point which gives them the name 4-Digits or 2-Digits. Any more digits added after the Standard is referred to as Point. Points are not just limited to 3 or 5 digits. A broker can break the 100,000 Lot down to as small as they want. 100,000=0.0001....10,000=0.00001....1000=0.000001 etc.

 
On a 4 digit broker a point == pip. On a 5 digit broker a point is 1/10 pip. Either you must adjust all your pip values when you move from a 4 to a 5 broker or the EA must adjust.
//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
     if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
//---- These are adjusted for 5 digit brokers.
    /* On ECN brokers you must open first and THEN set stops
    int ticket = OrderSend(...)
    if (ticket < 0)
       Alert("OrderSend failed: ", GetLastError());
    else if (!OrderSelect(ticket, SELECT_BY_POS))
       Alert("OrderSelect failed: ", GetLastError());
    else if (!OrderModify(OrderTicket()...)
       Alert("OrderModify failed: ", GetLastError());
     */
 
WHRoeder:
On a 4 digit broker a point == pip. On a 5 digit broker a point is 1/10 pip. Either you must adjust all your pip values when you move from a 4 to a 5 broker or the EA must adjust.

Thanks I have now got it properly understood.
 
const double _Pip = 0.0001;  // Percentage In Point  

int Digits(double value) { return((int)MathAbs(MathRound(MathLog10(value)))); }

double PointsInPip(const string symbol)  
  {   
   int digits  = (int)SymbolInfoInteger(symbol, SYMBOL_DIGITS);
   double bid =  NormalizeDouble(SymbolInfoDouble(symbol, SYMBOL_BID), digits); // 
   double point = SymbolInfoDouble(symbol, SYMBOL_POINT);
   double pipDigits = Digits(_Pip * bid);         
   double pipPoint;
   if(pipDigits == 0) pipPoint = 1.0;
   else pipPoint = 1 / MathPow(10, pipDigits);         
   return(pipPoint / point);
  }
 
bwa:
A pip or point is a change in price. Bid is a price. Change * Price is meaningless. Just as [27.926528,-80.6164381] times 2 inches.
 
whroeder1:
A pip or point is a change in price. Bid is a price. Change * Price is meaningless. Just as [27.926528,-80.6164381] times 2 inches.

Well, what is the definition of a PIP anyway? Here I am assuming it is 1/100 of a percentage point. For practical purposes it cannot be anything else, if you want to make calculations with large numbers. Sure it is valid in forex by change, but how about CFD's?

All is fine when broker is consistent with the point to pip ratio, and the Point value is large enough. Digits can't go negative, do they? But look what happens on FxPro MT5:

#DJ30_M8: Bid=24556.0 Digits=0 Point=1.0 pipDigits=0.0 pipPoint=1.0 PointsInPip()=1.0

#Sugar_K8: Bid=13.42 Digits=2 Point=0.01 pipDigits=3.0 pipPoint=0.001 PointsInPip()=0.1

#NAS100_M8: Bid=6830.75 Digits=2 Point=0.01 pipDigits=0.0 pipPoint=1.0 PointsInPip()=100.0

You are multiplying by zero, that sure ain't right. And there is no consistency with sugar or Nasdaq either.


EDIT: Sorry, nobody is multiplying by zero (or at least don't need to), mixed digits and points here.

 
BigAl:

I am able to get my EAs working on any pair 3,4,5 decimal places but it would appear that I thought I understood this but obviously i dont!!! as i play with each to get it correct on any provider or currency pair.

Life is easier if you know what you are doing and it appears it can be done in one way for all possible combinations SO HELP!!!

Why do we need to take into account the difference between 3,4 and 5 decimal places by using if (digits ==3||digits ==5) Point = 10 else Point = 1.

I thought MarketInfo(Symbol(),MODE_POINT) did this for you in all cases?

What is the difference between MODE_POINT and just Point if any other than the chart your EA is on?

and finally what is the difference between point and pips?

I recommend to forget the "PIP". It's a relic and its only used for Forex but it isn't used for Metals (Gold, Silver...), Indexes (DAX,SP...) Commodities (OIL,Gas...) ...  MQL works with POINT native. You just have to pay attention to Tick size (MODE_TICKSIZE).
 
Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. Compute what a PIP is and use it, not points.
          How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
          Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum
 
whroeder1:
Using Points means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points,) and metals. Compute what a PIP is and use it, not points.
          How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
          Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum

Using either Points or PIP means code breaks if you don't calculate with Tick size. In my opinion there isn't a reason for using PIP. Only Tick size is relevant.

BTW What is the effect of the spread size on PIP, Point or Tick size???

It's up to you if you want to use PIP but your code will be unpredictable on not Forex symbols.

 
Petr Nosek: Only Tick size is relevant. BTW What is the effect of the spread size on PIP, Point or Tick size??? on not Forex symbols
  1. If you program n * TickSize on a 4 digit broker and then move to a 5 digit broker, or visa versa, your code breaks on Forex because TickSize equals Point. But 0.0123 equals 0.01230. If you move to one of the exotics, your code breaks because PIP is to small there.

  2. None! PIP, Point, or Ticksize are units of measure. Spread can be stated as an absolute measure (0.00123) or given in PIPs (12.3,) or in Points or Ticksize (123). [Assuming 5 digit non-JPY pair.]

  3. Which is what my code adjusts for. If you're going to specify an arbitrary constant, at least have it adjust for different symbols.
Reason: