If the Quote Currency is USD, you can calculate as follows:
Margin = (lot*Contract size/Leverage)/Exchange rate
Note : 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*Contrat 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 are established by the liquidity providers.