I am a newbe trying to get to grips with MT5. Please can someone answer my question below.
As each currency pair can only have one position is there a command/function to obtain the $value (assuming the base currency is USD) of that position or do I have to calculate it for myself?
I cant find anything in the documentation but someone told me there is such a function.
hi, i think that you are looking for that:
double somvariable=PositionGetDouble(POSITION_VOLUME);
I assume that by value you mean profit:
if(PositionSelect("USDJPY"))
{
double value = PositionGetDouble(POSITION_PROFIT);
}
I assume that by value you mean profit:
if(PositionSelect("USDJPY"))
{
double value = PositionGetDouble(POSITION_PROFIT);
}
Thanks for answers so far but what I actually want is the current value of the trade. That is lets say I purchased 1 lot of a pair that costs me 12000 xxs (EUR, USD or whatever). At a later time I would like to know the current value of that trade in xxs. the value could now be higher or lower or the same. I do not want the profit or lot size just the current total value. without having to calculate it.

- www.mql5.com

- www.mql5.com
Did you mean, the cost of opening a position/order ?. If it is, it's called Margin required. Use this https://www.mql5.com/en/docs/trading/ordercalcmargin also read this https://www.mql5.com/en/forum/7418#comment_295412 and read the whole topic if you like.
Thanks for answers so far but what I actually want is the current value of the trade. That is lets say I purchased 1 lot of a pair that costs me 12000 xxs (EUR, USD or whatever). At a later time I would like to know the current value of that trade in xxs. the value could now be higher or lower or the same. I do not want the profit or lot size just the current total value. without having to calculate it
BigAl,
Correct and give me example if I'm dead wrong.
1. Say you buy I.05 lots of EURUSD at 1.23435 - what you want to know is how much that cost you ?, Am I correct here ?
2. Later when this 1.05 lots EURUSD rise up to 1.30056, you also want to know how much does it cost you now at this price. Am I correct here too ?
I have resolved my problem thanks for your help
I have resolved my problem thanks for your help
BigAl
How to do to resolve the problem?, i have the same situation.
thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am a newbe trying to get to grips with MT5. Please can someone answer my question below.
As each currency pair can only have one position is there a command/function to obtain the $value (assuming the base currency is USD) of that position or do I have to calculate it for myself?
I cant find anything in the documentation but someone told me there is such a function.