# Two ways to show a profit show different results

I have written a method for close the position

```   bool ClosePosition_real(int currentMagic, double &_profit)
{
int total=PositionsTotal(); // number of open positions

for(int i=total-1; i>=0; i--)
{
ulong  position_ticket=PositionGetTicket(i);                                      // ticket of the position
string position_symbol=PositionGetString(POSITION_SYMBOL);                        // symbol
ulong  magic=PositionGetInteger(POSITION_MAGIC);                                  // MagicNumber of the position
int    digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);                       // number of decimal places
double volume=PositionGetDouble(POSITION_VOLUME);                                 // volume of the position
ENUM_POSITION_TYPE type=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);    // type of the position

if(magic==currentMagic)
{

tradeRequestClose.position =position_ticket;          // ticket of the position
tradeRequestClose.volume   =volume;                   // volume of the position
tradeRequestClose.magic    = currentMagic;       // MagicNumber of the position

{
}
else
{
}

_profit = NormalizeDouble(PositionGetDouble(POSITION_PROFIT), __digits);

double __debugVal;
__debugVal = NormalizeDouble(__debugVal, __digits);

{
return true;
}
else
{
PrintFormat("OrderSend error %d",GetLastError());  // if unable to send the request, output the error code
return false;
}
}
}
return false;
}```

The first way for viewing profits is the PositionGetDouble function that gives me the 16.6999 number and the second one is the OrderCalcProfit function that gives me 16.7199 number.

So the results are different, but I expect the same result because there are identical input data.

Can you explain to me why the results are different? How to fix it?

Look at the attached file:

Files:
diff.jpg  307 kb
Reason: