calculate profit in pips - page 2

 

according to me the best way to do

calculate pointvalueperlot

profit / pointvalueperlot == profitpoints per lot

on 5 digitbroker 10 point is 1 pip

and 4 digitbroker 1 point is 1 pip

I don't like the calculations with trading several lotsizes and all counting difference orderopenprice and ordercloseprice

 
ankitkalindi:

How can this ever be true ?

if(MarketInfo(Symbol(),MODE_DIGITS) == 3  &&   MarketInfo(Symbol(),MODE_DIGITS) == 5)

. . . the number of Digits can be 3 or 5 it can't be 3 AND 5 . . .

 
Thanks sir yes its big mistake RaptorUK sir and so deVries sir profit / pointvalueperlot == profitpoints per lot can you expalin me this because what i have you used is pipmultiplier so how can i convert those values in pips
 

Profit is in Dollars or Euros. PipsMultiplier (or my pips2dbl) just adjusts for 4/5 digit broker points to pips. The two are unrelated. Like asking how many apples are in 5 oranges.

You need the conversion factor PipValuePerLot

 

if someone like me land here from google, this is the function I've developed


/* @author William Roeder


* 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://www.mql5.com/en/forum/127584 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://www.mql5.com/en/forum/135345 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 */
    double DeltaValuePerLot()
    {
        return (MarketInfo(_symbol, MODE_TICKVALUE) / MarketInfo(_symbol, MODE_TICKSIZE)); // Not Point.
    }
        
double GetPipFromProfit(double argOrderProfit, double argVolume)
    {
        double deltaPip = DeltaValuePerLot();

        double prof = NormalizeDouble(((argOrderProfit / argVolume) / _point) / deltaPip, _digits);

        return prof;
    };

since I cut it from a class it's not a full code as you need to set those missing values like _digits, ...

Reason: