position.Profit() convert to pips

 

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 

 
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);
 
Karputov Vladimir:

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

Very nice ... thank you so much 

 
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)