Hello,
many posts here are about this problem. However, it seems this is not solved and the desk did not answer for this so far or in russian language.
The Problem: i do a trade , entry at price p1 and exit at price p2. MetaTrader shows the profit for this trade.
I like to calculate this profit with MQL5 methods, exactly this profit, so profit in account currency.
How to do this, given i have
a) symbol
b) p1
c) p2
d) volume
Thank you
For the attached class, PriceDelta would be difference btn p1 an p2. The profit returned is for one lot, so multiply it by you volume to get the loss or profit for your volume.
The method used is uselessly overcomplicated.
You don't have to convert yourself to account currency, simply use SYMBOL_TRADE_TICK_VALUE in your formula.The method used is uselessly overcomplicated.
You don't have to convert yourself to account currency, simply use SYMBOL_TRADE_TICK_VALUE in your formula.The method used is uselessly overcomplicated.
You don't have to convert yourself to account currency, simply use SYMBOL_TRADE_TICK_VALUE in your formula.There was a time when SYMBOL_TRADE_TICK_VALUE was buggy... If it works ok now, that's fine...
If it's buggy, then ask the correction of the bug.
Why did you remove your post ?
- www.mql5.com
- www.mql5.com
It should not have been made available free in the first place. My err in judgement. Sorry.
Hello guys,
thank you for replies gentlemen.
Can one of you give a simple formular for my problem ? So other users, having the same problem can just copy this formular.
I know about SYMBOL_TRADE_TICK_VALUE but it simply not works. When i evaluate a trade report about fill price of a position
opened and price when position closed and resulting profit i can't calculate this profit using SYMBOL_TRADE_TICK_VALUE.
Of course in my tests no other symbols were opened at this time.
If you can calculate exaclty the profit, please just post your formular here and this problem should be solved for all times.
Thank you.
formular input
a) symbol
b) p1
c) p2
d) volume
output: costs in account currency.
(I mentioned the desk because i posted my question there along with detailed sample, screenshots, my code for this
and got no really helpful answer. )
Hello guys,
thank you for replies gentlemen.
Can one of you give a simple formular for my problem ? So other users, having the same problem can just copy this formular.
I know about SYMBOL_TRADE_TICK_VALUE but it simply not works. When i evaluate a trade report about fill price of a position
opened and price when position closed and resulting profit i can't calculate this profit using SYMBOL_TRADE_TICK_VALUE.
Of course in my tests no other symbols were opened at this time.
If you can calculate exaclty the profit, please just post your formular here and this problem should be solved for all times.
Thank you.
formular input
a) symbol
b) p1
c) p2
d) volume
output: costs in account currency.
(I mentioned the desk because i posted my question there along with detailed sample, screenshots, my code for this
and got no really helpful answer. )
- Why do you need to calculate profit ? It's already calculated for you by the platform, and accessible with mql5, see DEAL_PROFIT.
- If that doesn't work, show what you have tried, so maybe we can understand why.
- You don't have enough input (symbol, p1, p2, volume), you also have to know direction (BUY/SELL) to calculate the profit.
- The general formula is profit = number_of_pips * pip_value or profit = number_of_ticks * tick_value.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
many posts here are about this problem. However, it seems this is not solved and the desk did not answer for this so far or in russian language.
The Problem: i do a trade , entry at price p1 and exit at price p2. MetaTrader shows the profit for this trade.
I like to calculate this profit with MQL5 methods, exactly this profit, so profit in account currency.
How to do this, given i have
a) symbol
b) p1
c) p2
d) volume
Thank you