# Complete formula for calculating forex pip value for XAUUSD with account funded in euros

I'm currently developping forex robot using Python API for Metatrader 5. Among different things, this robot places trades given by external signals (with price, SL and TP).

I use euro funded account, trade XAUUSD, and have a 1:100 leverage ratio. In order to implement 1% strategy (meaning never risk more than 1% of capital in one trade), I would like to calculate precise SL/TP level in euro, my account money, and fail to compute same results as given in my MT5 terminal.

If I take a trade as example (informations sourced from MT5):

• SELL XAUUSD, price \$1849.32 • lot size : 0.01 • date : 2022.05.31 13:31:05 • closed at price$1848.03
• profit announced by MT5 : 2,4€

What's the formula used to calculate this amount, placing leverage and exchange rate from USD to EUR ?

My method so far:

AFAIK, pip value for an USD account with USD as last currency in pair (i.e XAUUSD) is:

Applied to given trade above (result in dollars):

Total trade value (in dollars, without any leverage)

From this point, I can't find any way to include leverage and exchange rate for finding this 2,4€ profit.