# Calculation of Pips

108

Hi,

i am a little bit confused... MyFXBook calculate pips in trade history:

I want to calculate this "pips" in my EA oder Indicator. MyFXBook deleted my forum post, so I try to ask one of you how this value is calculated?

Best regards

Moderator
7130

Hi,

i am a little bit confused... MyFXBook calculate pips in trade history:

I want to calculate this "pips" in my EA oder Indicator. MyFXBook deleted my forum post, so I try to ask one of you how this value is calculated?

Best regards

14882

Hi,

i am a little bit confused... MyFXBook calculate pips in trade history:

I want to calculate this "pips" in my EA oder Indicator. MyFXBook deleted my forum post, so I try to ask one of you how this value is calculated?

Best regards

I suppose, that myfxbook doesn't calculate pips value, but simply reading it from statements.

As Carl wrote, If you need to calculate "pips" value ask uncle Google.

108

I googled a lot of days, but I don't understand it...

This is the part of my code:
double myPoint;

int OnInit() {

if (Digits == 5 || Digits == 3) {
myPoint = Point*10;
} else {
myPoint = Point;
}

return(INIT_SUCCEEDED);
}

void OnTick() {

Comment(OrderTicket()+": " + NormalizeDouble((OrderClosePrice()-OrderOpenPrice()),Digits)/myPoint;

}

EURUSD | OrderOpenPrice() = 1.07028 | OrderClosePrice() = 1.07020

In Terminal, I show the Profit > as Point.

Comment (from my code) shows: 0.8
Terminal shows: 8
If I use the crosshair to messure the distance, it shows also 8

Therefore I am confused...

Please give me a hint, what is wrong in my calculation or do I have thinking errors??

Moderator
2302

double myPoint;

int OnInit() {

if (Digits == 5 || Digits == 3) {
myPoint = Point*10;
} else {
myPoint = Point;
}

return(INIT_SUCCEEDED);
}

void OnTick() {

Comment(OrderTicket()+": " + NormalizeDouble((OrderClosePrice()-OrderOpenPrice()),Digits)/myPoint;

}

EURUSD | OrderOpenPrice() = 1.07028 | OrderClosePrice() = 1.07020

In Terminal, I show the Profit > as Point.

Comment (from my code) shows: 0.8
Terminal shows: 8
If I use the crosshair to messure the distance, it shows also 8

MetaTrader works in points not pips.

Many people are trading forex with a 5 digit broker. Your broker quotes EURUSD to 5 digits: 1.07028

On 5 digit brokers, there are 10 points to a pip.

So, your code is correct (see parts highlighted in yellow).

8 points = 0.8 pips

17942

Comment(OrderTicket()+": " + NormalizeDouble((OrderClosePrice()-OrderOpenPrice()),Digits)/myPoint;
1. You can not use any Trade Functions - MQL4 Reference unless you select a ticket first.
2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong