OrderProfit giving wrong value

 

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

 
OrderProfit() works for those who know what they're doing. Maybe you should learn about Lot Size and Values.
 
if u dont have any constructive help then dont waste my or your time
 
makapaka:

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

 
I found ubzen's post to the point and helpful. Did you read the documentation ? it isn't returning 300 pips . . it's returning $300 (or 300 of whatever your account currency is) if you want the number of pips use OOP and OCP and work it out.
 

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);

 
makapaka:

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);

WOW, what a discovery, i did not know that, and I'm pretty sure, no one here knew that, thanks for bringing this to our attention
 
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
 
deVries:
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

 
makapaka:

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);

  1. 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?
  2. 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.
    }
Reason: