Margin is not a fee or a transaction cost. Margin is simply a portion of your funds that your forex broker sets aside from your account balance to keep your trade open and to ensure that you can cover the potential loss of the trade. To calculate it, multiply the size of the trade by the margin percentage. Then, subtract the margin used for all trades from the remaining equity in your account.