Margin is calculated as the Position’s Value, converted into your account’s currency and divided by Leverage.
Example A:
Trading account currency: EUR
Currency pair traded: EUR/USD at 1.34500
Lot Size traded: 1.00 (100,000 units)
Leverage: 1:50 Margin = EUR100,000 / 50 = EUR 2,000.00
Example B:
Trading account currency: USD
Currency pair traded: EUR/USD at 1.17500
Lot Size traded: 1.00 (100,000 units)
Leverage: 1:50 Margin = EUR 100,000 * 1.17500 / 50 = USD 2,350.00
See more on Margin Requirements and Contract Specifications.