Download MetaTrader 5

position.Profit() convert to pips

To add comments, please log in or register
Improve your rating. Execute orders in Freelance service!
20188628
10
20188628 2016.10.07 12:57 

Hi, everybody 

So i look for the solution to convert the profts to pips ...

i use the class  CPositionInfo

CPositionInfo _position = new CPositionInfo;

Comment(DoubleToString(position.Profit())); <<<< the value is money 

how convert the "position.Profit()" to pips ?? 

 Help me please .... thank you 

Vladimir Karputov
Moderator
45494
Vladimir Karputov 2016.10.07 14:52  
20188628:

Hi, everybody 

So i look for the solution to convert the profts to pips ...

i use the class  CPositionInfo

CPositionInfo _position = new CPositionInfo;

Comment(DoubleToString(position.Profit())); <<<< the value is money 

how convert the "position.Profit()" to pips ?? 

 Help me please .... thank you 

Use the difference between PriceOpen and PriceCurrent and SYMBOL_DIGITS. Just set your correct symbol:

   CPositionInfo my_pos;
   
   double difference;
   my_pos.Select(Symbol());
   if(my_pos.PositionType()==POSITION_TYPE_BUY)
      difference=my_pos.PriceCurrent()-my_pos.PriceOpen();
   else
      difference=my_pos.PriceOpen()-my_pos.PriceCurrent();

   long symbol_digits=SymbolInfoInteger(my_pos.Symbol(),SYMBOL_DIGITS);
   int profit_pips=(int)(difference*MathPow(10,symbol_digits));
   Print("Profit in pips: ",profit_pips);
20188628
10
20188628 2016.10.07 15:41  
Karputov Vladimir:

Use the difference between PriceOpen and PriceCurrent and SYMBOL_DIGITS. Just set your correct symbol:

Very nice ... thank you so much 

garpits
16
garpits 2016.10.08 02:59  
20188628:

Hi, everybody 

So i look for the solution to convert the profts to pips ...

i use the class  CPositionInfo

CPositionInfo _position = new CPositionInfo;

Comment(DoubleToString(position.Profit())); <<<< the value is money 

how convert the "position.Profit()" to pips ?? 

 Help me please .... thank you 


pip = OrderProfit() / MarketInfo(Symbol(), MODE_TICKVALUE)
To add comments, please log in or register