Thread: How to code?
View Single Post
  #546 (permalink)  
Old 12-10-2007, 08:42 PM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by FXTradepro View Post
Thanks for the response - I am not a coder so this is a bit foreign to me. I did try Point*10 and that made the spread reading 410 pips. I also tried Point/10 and that made the spread reading 4.0 pips which appears to be "rounding" off the actual number which should have been 4.1 pips.

I do have a script for sending orders that I had to modify using Point*10, but I cannot seem to get this spread reading correct.

I think this is going to become an issue for many Indicators, Scripts and EA's, as I have heard that many MT4 Brokers might be adopting the fractional pip concept on their platforms.

Any other advice would be appreciated.

Dan
No worries. As I understand it, the term "pips" has grown a definition relating to trade size, meaning that a 1 pip move of a 1 lot trade corresponds to a known value amount. The term "Point" in MT4 more strictly means the granularity of price movement, i.e. the smallest difference there can be between two prices; or that every Bid/Ask price is some integer N times Point.

So far there has been a 1-1 translation between pips and Point in MT4, but that's no longer the case. Instead, for your broker, you have 1 pip = 10 Point, and therefore, if you want the "spread" variable to be in pips you will have to use the expression "(Point*10)" wherever you previously used "Point". The expression is without the double-quotes, but *with* the parentheses.

To make it very clear in the code, you could also add a function to provide the appropriate pips measure:
PHP Code:
double pips() { return ( Point 10.0 ); } 
and in that case, you would replace "Point" at all other places with the function call "pips()".

Alternatively, you let the program work with the Point granularity, and merely translate to pips when the spread value is presented. I.e. forget about using the pips() function above, but have the following function for translating a Points value to be a pips value:
PHP Code:
double pips(int points) { return ( 1.0 points 10.0 ); } 
Then the spread value component in the ObjectSetText call would be like:
PHP Code:
DoubleToStrpipsSpread ), 

Last edited by ralph.ronnquist; 12-10-2007 at 08:44 PM.
Reply With Quote