If the Quote Currency is USD, you can calculate as follows:
Margin = (lot * Contract Size/Leverage)/Exchange rate
Note: The exchange rate converts from Base Currency into Account Currency.
For example;
Open SELL 0.1 GBPUSD, 1:200 Leverage, 100,000 Contract Size, and the Exchange rate is 0.92.
Margin = (Lot * Contract Size/Leverage)
= 0.1*100,000/200=62.59
= 50 GBP / 0.92
= $54.34
If the Base and Quote Currency is not USD, convert it to USD.
Margin = (lot * Contract Size/Leverage)
For example
Open SELL 0.1 USDJPY at 133.587, 1:200 Leverage, 100,000 Contract size.
Margin = (lot * Contract Size/Leverage)
= (0.1*100000/ 200)
= $50
For example:
Open SELL 0.1 GBPJPY at 167.275, 1:200 Leverage, 100,000 Contract size.
Margin = (lot * Contract size/Leverage)
= (0.1*100000/200)
= 50 GBP / 0.92
= $54.34
Calculation of Crude Oil, Indices, and Shares Margin
Margin = (Open price * Lot * Contract Size/Leverage)
Note: Leverage of crude oil, indices, and shares is established by the liquidity providers.