calculate diference of pips/points between openprice order and market price

 

Hello,

how can i calculate diference of pips or points between openprice order and market price ?

thanks

 
bybruno2: Hello,how can i calculate diference of pips or points between openprice order and market price ? thanks

Is this in MQL code or on the chart?

If this is for code, then it is a very basic request, so I am assuming you have not studied MQL programming at all. So I would suggest to start your learning by studying various examples in the CodeBase and the with the help of the documentation, make small changes as you experiment and learn and improve your coding skills in MQL.

If however, your question is about a very specific case, then show your code attempting this and we will help guide you to resolve the issue.

 
bybruno2: how can i calculate diference of pips or points between openprice order and market price ?
When in doubt, think!
double openPrice   = OrderOpenPrice();                  // Or MT5
double marketPrice = OrderType() == OP_BUY ? Bid : Ask; // equivalent.

double differencePoints = (marketPrice - openPrice) / _Point;
double differencePips   = (marketPrice - openPrice) / PIP();
 
Fernando Carreiro #:

Is this in MQL code or on the chart?

If this is for code, then it is a very basic request, so I am assuming you have not studied MQL programming at all. So I would suggest to start your learning by studying various examples in the CodeBase and the with the help of the documentation, make small changes as you experiment and learn and improve your coding skills in MQL.

If however, your question is about a very specific case, then show your code attempting this and we will help guide you to resolve the issue.

thank you for your help, yes i have but this is new for me
 
William Roeder #:
When in doubt, think!
thank you, that help me :)
 
bybruno2 #: thank you for your help

You are welcome!

Reason: