Margin is always calculated in the instrument currency, which is then converted to the account currency.
To calculate margin in Forex pairs you can use this formula:
Lots * Contract size / Leverage
For example, if you would like to trade 1 lot of EURUSD with a leverage of 1:500, this is the margin requirement calculation: 1*100,000/500= 200 EUR= 237.53 USD.
To calculate margin for gold or silver the formula is:
Lots Contract Size Current Market Price * Margin requirements%
For example, if you would like to trade 1 lot of XAUUSD the calculation is 1*100*1740*0.5/100 = 870 USD.
If you would like to trade silver, the calculation is 1*5000*25.391*1/100=1269.55 USD
Contract sizes:
XAUUSD,XAUEUR(Gold) contract size per 1 lot = 100
XAGUSD,XAGEUR(Silver)Contract size per 1 lot = 5,000
XAUUSD,XAUEUR margin requirement = 0.5% = 1:200 (constant)
XAGUSD,XAGEUR margin requirement = 1% = 1:100 (constant)
EURUSD = 1.197179
JPYUSD = 109.272
DE30 Example
DE30 1 Lot ==> 1*115270.201/100 = 152.702 EUR = 152.702 1.19179 = 181.98 USD
JP225 Example
JP225 1 Lot ==> 1*100*29769*1/100= 29769 JPY = 29769/109.272 = 272.43 USD