Download MetaTrader 5

points == pips? - page 3

To add comments, please log in or register
Ubzen
5390
Ubzen  
doshur: who has the sweetest function to convert pips to point?

I'll just cut_to_the_chase here to avoid a lengthy explanation/probing_you. I believe what you're looking for is something to convert the Integer_Representation of Pip into Integer_Representation of Point. Example:

int _Stoploss= 20; // Enter Value In Pips
int _TakeProf= 40;  // Enter Value In Pips
int _Slippage= 2;    // Enter Value In Pips
 
void OnTick(){
     ulong Deviation = (ulong) Pips_to_Points( _Slippage ) ;
     mytrade.SetDeviationInPoints( Deviation );
}
 
int Pips_to_Points( int my_pips ){
     /* This function converts Integer_Representation of Pips into Integer_Representation of Points */ 
     int result=0;
     int ChartSymDigits=Digit();
     if( ChartSymDigits % 2 == 1){ result = my_pips*10; }else{ result=my_pips; }
     return( result );
}

The example could be made shorter. However the %2 is the sweetest/shortest version I've seen.

ulong p2points(ulong x){if(Digit()%2==1){return(x*10);}else{return(x);} }

//note: %2 upon a function may not work in mql5 but there u have it. untested. 

Alain Verleyen
Moderator
29862
Alain Verleyen  
Ubzen:

I'll just cut_to_the_chase here to avoid a lengthy explanation/probing_you. I believe what you're looking for is something to convert the Integer_Representation of Pip into Integer_Representation of Point. Example:

...

//note: %2 upon a function may not work in mql5 but there u have it. untested. 

Why did you not use the SRC button ? Please edit your post. Thanks
Ubzen
5390
Ubzen  
angevoyageur:
Why did you not use the SRC button ? Please edit your post.
I don't consider it a SRC because I didn't create in editor. But It does look pretty now .... thanks.
Alexander Piechotta
7184
Alexander Piechotta  

How do I get the digits after the decimal point ?

Example: 2.2034 =  4 digits

Alain Verleyen
Moderator
29862
Alain Verleyen  
FinGeR:

How do I get the digits after the decimal point ?

Example: 2.2034 =  4 digits

Not sure I understand your question. Digits() ?
Dua Yong Rew
5554
Dua Yong Rew  
Ubzen:

I'll just cut_to_the_chase here to avoid a lengthy explanation/probing_you. I believe what you're looking for is something to convert the Integer_Representation of Pip into Integer_Representation of Point. Example:

The example could be made shorter. However the %2 is the sweetest/shortest version I've seen.

//note: %2 upon a function may not work in mql5 but there u have it. untested. 

That's sweet enough
Simon Gniadkowski
Moderator
18058
Simon Gniadkowski  
FinGeR:

How do I get the digits after the decimal point ?

Example: 2.2034 =  4 digits

Do you mean _Digits ?  or SymbolInfoInteger()  with  SYMBOL_DIGITS  ?
Alexander Piechotta
7184
Alexander Piechotta  

I mean only _Digits  

Sergey Golubev
Moderator
101647
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

Press review

newdigital, 2014.01.06 18:38

What is the Pip Cost for Gold and Silver?


  1. Gold: Symbol XAU/USD
    The pip cost for 1 ounce of Gold (minimum trade size) is $0.01 per pip.
  2. Silver: Symbol XAG/USD
    The pip cost for 50 ounces of Silver (minimum trade size) is $0.50 per pip

Rogerio Figurelli
Moderator
46420
Rogerio Figurelli  
angevoyageur:
It's YOUR definition, so of course it's very precise to you. What you said confirm exactly what I wrote  : "A pip is a very unprecise unit." Its definition varies from person to person. What you define as a pip is actually a point.

I totally agree that pip is today an imprecise unit that definition varies from person to person.

I mean today because one day in the past, when 1 pip was 1 point for Forex, it was precise.

However, now we have more digits and platforms, like MT5, trading Forex and Stocks, where pips have no precise meaning as points do. So now we don't have anymore a standard pips definition, because points value is not static.

So, with this change, we don't have more a precise pip definition, since someone can use old reference (pip==0.0001 for EUR/USD) and other can use pips as the same as points (pip==point). To be honest, I prefer the old one, since I was used to, but you can use your reference for pip and you are right to, since original definition of pip was really one point in Forex.

Anyway, I just see two possibilities for pip definition. The old one (pip==0.0001 for EUR/USD forever) or the new one (pip==point whatever value point is now or will be in the future). What do you guys prefer?

To add comments, please log in or register