Points/Pips Conversion to Currency USD

 

Hello i was wondering if someone had managed to actually convert the points to currency and the other way around currency to points of different pairs.

I have tried some stuff but the miscalculate always : 

// Convert currency (USD) to points
double USDtoPoints(double amountUSD)
{
    double pointSize = SymbolInfoDouble(Symbol(), SYMBOL_POINT);
    double tickSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE);
    double tickValue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE);

    double pointValue = tickValue / tickSize;
    double amountPoints = amountUSD / pointValue;

    return NormalizeDouble(amountPoints, SymbolInfoInteger(Symbol(), SYMBOL_DIGITS));
}

// Convert points to currency (USD)
double PointsToUSD(double points)
{
    double tickSize = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_SIZE);
    double tickValue = SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE);

    double pointValue = tickValue / tickSize;
    double amountUSD = points * pointValue;

    return NormalizeDouble(amountUSD, SymbolInfoInteger(Symbol(), SYMBOL_DIGITS));
}