price difference to pips for exotics and indices ?

 

Is there a near universal method to convert price difference between open and close of any symbol bar to pips . One that works with even exotic pairs and indices . Is it even  possible ?
I am currently using the follwing code for the purpose . It works great for most of symbols from the marketwatch  but gives very large or weird values for exotics and indices . I dont mind using few more if else statements to make the code give correct pip value for all symbols including exotics , indices and metals , how can I achieve this ? Thank you .

int OnInit()
{

if(Digits==4 || Digits==5)
      PipPoint=0.0001;
   else
   if(Digits==2 || Digits==3)
      PipPoint=0.01;
   else
      PipPoint=Point;
    
    return(INIT_SUCCEEDED);
}

.......................................................................


OpenCloseDifferencePips= MathRound((MathAbs(Open[1]-Close[1]))/PipPoint); // it works great of most but not for the ones listed below

......................................................................


The pairs it gives weird/large values on  .

Exotics Indices Metals and Oil
GBPHUF EURHUF USDHUF CADNOK GER30 JPN225 XAUUSD
GBPMXN EURMXN USDMXN CHFHUF HK50 EUSTX50 XAGUSD
GBPNOK EURNOK USDNOK CHFNOK SPA35 AUS200 UKOIL
GBPPLN EURPLN USDPLN NOKSEK NAS100 AEX25 USOIL
GBPSEK EURSEK USDSEK FRA40 SPX500
GBPZAR EURZAR USDZAR US30 SWE30
SUI30
FTSE100
 
deral5:Is there a near universal method to convert price difference between open and close of any symbol bar to pips . One that works with even exotic pairs and indices . Is it even  possible ?
  1. PIP only applies to currencies.
  2. PIP, Point, or Tick are all different in general.
              Ticks, PIPs or points in the GUI. Make up your mind. - MQL4 programming forum #1 (2014)

    Unless you manually adjust your SL/TP for each separate symbol, using Point 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 programming forum (2017)
              Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018)

 
William Roeder #:
  1. PIP only applies to currencies.
  2. PIP, Point, or Tick are all different in general.
              Ticks, PIPs or points in the GUI. Make up your mind. - MQL4 programming forum #1 (2014)

    Unless you manually adjust your SL/TP for each separate symbol, using Point 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 programming forum (2017)
              Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018)

Thank you so much William for the great info and the links . I will read them . If you dont mind me asking the most basic of question . You said compute what a PIP is and use it . How do I compute the PIP for the

exotics like USDZAR , GBPMXN etc if not using the points ? Thank you again.

 
deral5 #: If you dont mind me asking the most basic of question . You said compute what a PIP is and use it . How do I compute the PIP for 

You answered your own question.

deral5 #: the links . I will read them . I
 
The currency pair, the exchange rate, and the transaction value all affect how much a pip is worth. When your forex account is funded with U.S. dollars and USD is the second of the pair (or the quote currency), such as with the EUR/USD pair, the pip is fixed at .0001.
Reason: