Here are some examples to help tie all this together. Suppose you fund an account with $5,000 and open a $10,000 short position using 5x leverage. Your margin is one-fifth of the total cost of the position, so $2,000. The margin level when you open the position is ($5,000 ÷ $2,000)×100 = 250%. If your position has an unrealized loss of $3,500, your equity would be $5,000 - $3,500 = $1,500. Your margin level would then be ($1,500 ÷ $2,000)×100 = 75%. At this level, you are in danger of being liquidated. When a liquidation occurs, your oldest position will be closed first, followed by newer positions (FIFO). All open positions are vulnerable to liquidation, regardless of the currency pair or unrealized profit/loss.
As you can see from this example, it's possible to open a position twice as large as your account balance and still be able to endure a sizable loss before margin call. Your own risk management on this trade should have you closing your position well before margin call, but it's good to understand what the limits are.
Let's see what happens in the example above had 2x leverage been used instead of 5x. With 2x leverage the margin for the position is $5,000. So as soon as the position is opened the margin level is 100%. The system might let you open this position (though it wouldn't let you open a position where your margin level starts below 100%), but it wouldn't be a good idea to open a position where your margin level starts so low because you are already close to being liquidated. An unrealized loss on the position of $1,250 would bring your margin level to 75% where you are in danger of being liquidated. More leverage should be used so the margin level starts higher and a stop should be set on the position so that the position is closed well before there is any danger of margin call.
You need to be careful about opening a very large position relative to the size of your account. Suppose in our example that you open a $20,000 position instead of $10,000 (again with 5x leverage). Your margin for this position is $4,000. Your starting margin level is ($5,000 ÷ $4,000)×100 = 125%. If this position has an unrealized loss of 10% ($2,000), this would put you at margin call (margin level of 75%). To avoid this, suppose you set a stop on the position of 5% ($1,000). If this stop is reached, your account will lose 20%. Since the position is four times as large as your trade balance, your account balance will gain or lose four times as much (percentage-wise) as the position.
FIFO note- while positions will be sent for liquidated based on FIFO, multiple pairs might have different execution times as time priority for fill will be per order book.