Sorry for the noob question, but all along i thought the orderprofit() function would be smart enough to give true pip value, but it doesnt seem so.
Im testing on 4 digit broker Fxpro, and the profit of 30 pips is returning as 300 via OrderProfit(). How can i fix this ?
thx
makapaka:
if u dont have any constructive help then dont waste my or your time
That was the best piece of constructive help you'll ever get on this topic. In conclusion of this thread you'll realize that you'll need to expand your knowledge base instead of placing the blame on something which Millions of Programmers have been using for over half a decade. The problem is not OrderProfit()... the problem is you. Here visit BabyPips.com. Lesson#1 if you're going to learn programming or trading you need to learn to stop placing blames elsewhere for things which you do-not yet understand.
theres always a hero like u on every forum isnt there .. the reason i asked the question is because the documentation is unclear, basically like u. I never blamed anything or anyone, i was just looking for a clear answer.
Anyway you can stop being the forum hero cos i did find the answer
yeh i realised that now - at first read its not clear if its dollars or pips
anyway, for anyone who might be seeing this later, the solution i'm using is:
NormalizeDouble(OrderProfit()/OrderLots()/MarketInfo(OrderSymbol(),MODE_TICKVALUE),0);
yeh i realised that now - at first read its not clear if its dollars or pips
anyway, for anyone who might be seeing this later, the solution i'm using is:
NormalizeDouble(OrderProfit()/OrderLots()/MarketInfo(OrderSymbol(),MODE_TICKVALUE),0);
Funny, OrderProfit() gives always a wrong value It is like bruto Profit the real Netto Profit is it when there is no OrderCommission and no OrderSwap
no, it's not, OrderProfit() gives u OrderOpenPrice() - OrderClosePrice() * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE)
but, if u want to know what left in your pocket u have to concider your OrderCommission() & OrderSwap() 2
yeh i realised that now - at first read its not clear if its dollars or pips
anyway, for anyone who might be seeing this later, the solution i'm using is:
NormalizeDouble(OrderProfit()/OrderLots()/MarketInfo(OrderSymbol(),MODE_TICKVALUE),0);
- Not clear? What part of Returns the net profit value (without swaps or commissions) confused you? What broker do you know charges commissions in pips?
- Tick Value must be used as a ratio
double PipValuePerLot(string pair=""){ return(DeltaValuePerLot() * pips2dbl); } double DeltaValuePerLot(string pair=""){ /* Value in account currency of a Point of Symbol. * In tester I had a sale: open=1.35883 close=1.35736 (0.0147) * gain$=97.32/6.62 lots/147 points=$0.10/point or $1.00/pip. * IBFX demo/mini EURUSD TICKVALUE=0.1 MAXLOT=50 LOTSIZE=10,000 * IBFX demo/standard EURUSD TICKVALUE=1.0 MAXLOT=50 LOTSIZE=100,000 * $1.00/point or $10.0/pip. * * https://forum.mql4.com/33975 CB: MODE_TICKSIZE will usually return the * same value as MODE_POINT (or Point for the current symbol), however, an * example of where to use MODE_TICKSIZE would be as part of a ratio with * MODE_TICKVALUE when performing money management calculations which need * to take account of the pair and the account currency. The reason I use * this ratio is that although TV and TS may constantly be returned as * something like 7.00 and 0.0001 respectively, I've seen this * (intermittently) change to 14.00 and 0.0002 respectively (just example * tick values to illustrate). * https://forum.mql4.com/43064#515262 zzuegg reports for non-currency DE30: * MarketInfo(Symbol(),MODE_TICKSIZE) returns 0.5 * MarketInfo(Symbol(),MODE_DIGITS) return 1 * Point = 0.1 * Prices to open must be a multiple of ticksize */ if (pair == "") pair = Symbol(); return( MarketInfo(pair, MODE_TICKVALUE) / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point. }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Sorry for the noob question, but all along i thought the orderprofit() function would be smart enough to give true pip value, but it doesnt seem so.
Im testing on 4 digit broker Fxpro, and the profit of 30 pips is returning as 300 via OrderProfit(). How can i fix this ?
thx