Download MetaTrader 5
To add comments, please log in or register
Need mobile version of MetaTrader 5? Download it and trade!
Carl Schreiber
5939
Carl Schreiber 2014.07.30 08:29 

Hi,

I  yesterday faced a surprising feature of a new broker, here the array of the difference to another broker:

Symbol Descr. Point Digits Diff Spread Stp-Level LotSize TickValue TickSize
USDCNH US Dollar vs Chinese 0,0001 4
1 30 100000 1,619 0,0001
USDCNH US Dollar vs offshore RMB (Chinese Renminbi) 0,00001 5 1 348 0 100000 0,121 0,00001
USDNOK US Dollar vs Norwegian Kronor 0,00001 5
182 500 100000 0,160 0,00001
USDNOK US Dollar vs Norwegian Krona 0,0001 4 -1 11 0 100000 1,193 0,0001
XAGUSD Silver Spot 0,01 2
4 10 1000 10,000 0,01
XAGUSD Silver 0,0001 4 2 120 0 5000 0,373 0,0001
XAUUSD Gold Spot 0,01 2
28 30 100 1,000 0,01
XAUUSD Gold 0,001 3 1 90 0 100 0,075 0,001


His Gold digits are 3 and even more for Silver he has 4 digits.

Up to yesterday I was quite comfortable with this:

double getPIPs(string sym, int dig, double pnt) { //calcPIP(string S="") {
        if ( StringFind(sym,"XA",0) >= 0 || StringFind(sym,"GOLD",0) >= 0 || StringFind(sym,"SILVER",0) >= 0 ) {
                if ( dig%2==0)  return(10.0*pnt); // the additional decimal 2
                return(pnt); // 
        }
        if ( dig%2==1) return(10.0*pnt); // the additional decimal 5 || 3
        return(pnt); // 
} 

Now I about to 'hard-code' the Gold- and Silver-PIP (instead of: if (broker ...):

double getPIPs(string sym, int dig, double pnt) { //calcPIP(string S="") {
        if ( StringFind(sym,"XA",0) >= 0 || StringFind(sym,"GOLD",0) >= 0 || StringFind(sym,"SILVER",0) >= 0 )
           return(0.1);
        if ( dig%2==1) return(10.0*pnt); // the additional decimal 5 || 3
        return(pnt); // 
}

Any thought or comments or even a better way to calculate 1 PIP without broker-individualisation as I don't like hard-coded values too much.

Thanks in advance

Keith Watford
Moderator
7899
Keith Watford 2014.07.30 10:20  

For instruments such as Gold, there is no consensus as what constitutes a "Pip".

I would have the input

input double Pip_as_a_decimal=0.1;

 That allows the user to define what they consider a pip.

/
To add comments, please log in or register