How to understand the OpenPrice returned value?

 

Hi.

experimenting with the MQL and I noticed that a trade for GBPNZD on my demo was opened at Sell 1.90798. when I enquired about the OpenPrice through this fucntion, value return is double -> 156680407. Can someone explain how this converts to the actual price point?

I want to modify order with TakeProfit at 1.90698. What will be required to set in the function?


bool orderExist = OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
if(orderExist)
{
int orderTicket = OrderTicket();
double openPrice = OrderOpenPrice();
printf("%d is order ticket %d is the ope price, %d is the Order Total", OrderTicket(), openPrice, OrdersTotal() );
}
 

pradeep kumar: experimenting with the MQL and I noticed that a trade for GBPNZD on my demo was opened at Sell 1.90798. when I enquired about the OpenPrice through this fucntion, value return is double -> 156680407. Can someone explain how this converts to the actual price point? I want to modify order with TakeProfit at 1.90698. What will be required to set in the function?

bool orderExist = OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
if(orderExist)
{
int orderTicket = OrderTicket();
double openPrice = OrderOpenPrice();
printf("%d is order ticket %d is the ope price, %d is the Order Total", OrderTicket(), openPrice, OrdersTotal() );
} 

You are printing out the value incorrectly. "%d" is for integer values. For floating point use "%f" for example, or one of the other formats.

Symbol

Type

Output Format

d

int

Signed decimal integer

f

double

A real value in the format [-] dddd.dddd, where dddd - one or more decimal digits. Number of displayed digits before the decimal point depends on the size of number value. Number of digits after the decimal point depends on the required accuracy.

PrintFormat - Common Functions - MQL4 Reference
PrintFormat - Common Functions - MQL4 Reference
  • docs.mql4.com
PrintFormat - Common Functions - MQL4 Reference