The margin in your account is the amount of funds that are currently available to be used “also known as free margin” or the funds currently used by a position “known as used margin”. Margin is not deducted from your balance, but once margin is tied to a position it is not available for opening other positions.
All funds used to open the position are borrowed funds while the used margin can be thought as a kind of collateral, set aside from your balance for the loan. However, keep in mind that your loss on the position can be larger than the used margin.
If you open a $5,000 long position in XBT/USD with 5:1 leverage, your margin for the position is $1,000. But if you later close this position for Profit/Loss -$2,000, you have lost $2,000 - twice as much as the margin.
To ensure that you don’t end up losing more funds than you have in your account we utilize a feature known as margin level. The margin level feature helps protect you from being liquidated into a negative balance by calculating how much equity is required in your account in order to cover positions that are in a loss. Positions that are reaching a high risk level of causing a negative balance will automatically be liquidated before you are in a loss that can not be covered by your equity. This is measured through the margin liquidation level equation. It is important to note that margin is not the same as equity. Equity is based off the total value of all the currencies in your account plus your P/L while margin is only calculated on collateral currencies.
Example: suppose you currently hold 0.01017 XBT worth $79.36. You have opened up a position with 5:1 leverage and went long borrowing $239.5. This used up $47.99 worth of margin since Leverage (5) * 47.99 = $239.95. Leaving $31.25 worth of free margin left. This means you are capable of borrowing another $156.25 on 5:1 leverage with the remaining free margin.
Equity = trade balance + P/L
Eg. $79.24 = 79.36 + (-0.12)
Margin level = (equity - used margin)×100
Eg. 165.1% = (79.24 - 47.99) x 100.
Used margin = opening cost / leverage.
Eg. 47.99 = 239.95/5
Since XBT is being used as margin in this example if the value of XBT moves up or down this can result in a change to your equity value and margin level.
E.g. If the value of XBT went up 1% your equity would increase because of your long position and because the value of XBT in your account increased.