# Point Calculation

To add comments, please log in or register
189

How do i get the Point amount caculation  between OrderOpenPrice and StoppLoss in an open order?

thanks

Moderator
2360

One way would be to OrderSelect the order, then subtract the OrderOpenPrice from the OrderStopLoss

MathAbs might be useful to.

189

```void start()//void MinimumProfit()
{
double resOS;
if (OrdersTotal()>0)
resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
int A=OrderOpenPrice();
int B=OrderStopLoss();
int C=MP(A,B);
}
int MP(int val1,int val2);
{
MSL=(val1-val2);
return(MSL);
}```

thats what i have now but i have errors. i would like to see samples to learn. reference only shows a little to understand. please point me in the right way to see some

MathAbs code. I guess im wrong with this function

Thanks

6989

pieronetto:

thats what i have now but i have errors. i would like to see samples to learn. reference only shows a little to understand. please point me in the right way to see some

MathAbs code. I guess im wrong with this function

Thanks

1) I would strongly suggest to use brackets {..}!!

2) What do you expect to happen if OrdersTotal()==0 and/or resOS == false?

3) Have a little look in your Mt4-reference search for MathAbs..

189

```void start()//void MinimumProfit()
{
bool resOS;
double A,B,C,D,F,MP,SL;
resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
A=OrderOpenPrice();
B=OrderStopLoss();
C=OrderClosePrice();
D=B-A;
SL=MathAbs(D*100000);
F=C-A;
MP=MathAbs(F*100000);
if(MP>SL)
{
Alert("Close Position");
}
return;
}```

That what i have now it works. Please need to know about that *100000 if this is right?

I think i should put it this way other wise he shows somthing like 0.0004 and not 43 Point

Moderator
2360

Try dividing by Point rather than multiplying by 100000
189

honest_knave:
Try dividing by Point rather than multiplying by 100000
```void start()//void MinimumProfit()
{
bool resOS;
double A,B,C,D,F,MP,SL;
resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
A=OrderOpenPrice();
B=OrderStopLoss();
C=OrderClosePrice();
D=B-A;
SL=MathAbs(D*Point);
{
Print("StopLoss",SL);
}
F=C-A;
MP=MathAbs(F*Point);
{
Print("MinimumProfit",MP);
}
if(MP>SL)
{
Alert("Close Position");
}
return;
```
Than he shows 0 in the print?????????????
189

```void start()//void MinimumProfit()
{
bool resOS;
double A,B,C,D,F,MP,SL;
resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
A=OrderOpenPrice();
B=OrderStopLoss();
C=OrderClosePrice();
D=B-A;
SL=MathAbs(D/Point);
{
Print("StopLoss",SL);
}
F=C-A;
MP=MathAbs(F/Point);
{
Print("MinimumProfit",MP);
}
if(MP>SL)
{
Alert("Close Position");
}
return;
```
Got it , forgot dividing sorry and thanks a lot for u help
To add comments, please log in or register