How margin works
When you open a leveraged trade, your broker "locks" part of your balance as margin. It is not a fee: it is returned when the trade closes, adjusted for any profit or loss.
Required margin = position value ÷ leverage.
Margin level
Platforms such as MetaTrader show a margin level:
Margin level (%) = equity ÷ used margin × 100
If losses push your margin level down to the broker's margin call level you are warned, and at the stop-out level positions start closing automatically.
Why it matters
Margin tells you how much of your account is tied up, not how much you can lose. You can lose far more than the margin on a trade.