For Forex, VEMA does not calculate leverage, brokers instead have a set leverage for each asset.
For Crypto the short story is VEMA uses the highest possible leverage it can (and therefore the lowest possible margin) to place a trade without putting your liquidation price between Stop Loss and Entry, with some buffer on top of this to help avoid liquidation even in the event of slippage on entry or exit.
The full story is a little more complicated and involves a lot more maths.
Let's use OKX for our example.
OKX has what they call "Position tiers"
Different position sizes have different maximum leverage amounts, and different liquidation points.
Here is a screenshot of the position tiers for BTC-USDT-SWAP:
You can see a position less than 1000 contracts has a max leverage of 125x, where a position size of 20,001 - 40,000 has 50x max leverage.
This means there's no possible way we can submit a trade of 25,000 contracts at 125x leverage, regardless of Stop Loss Percentage, as OKX will not allow that trade, the max leverage on this position is 50x.
For the next part, there's two important terms to understand, Initial Margin Required (IMR), and Maintenance Margin Required (MMR).
Initial Margin Required (IMR)
Initial Margin Required is the amount of margin needed to open a position.
It's directly related to the max leverage, as IMR = (1 / Max Leverage) and Max Leverage = (1 / IMR) - known as an inverse relationship (as one goes up, the other goes down).
So if we wanted to open a 100 contract position, our IMR means we need 0.8% of the margin for that position.
If BTC is trading at $30,000 USD and a contract is worth 0.01 BTC, 100 contracts means a position size of 1 BTC for a position value of $30,000 USD.
At 0.8% Initial Margin Required, we need 0.8% of $30,000 USD to open this position, so we need to have $240 USD of margin ($30,000 USD position value x 0.8% Initial Margin Required) free in our account or we cannot place this trade and will hit the insufficient margin error.
We can then see how this relates to our leverage, as 125 x $240 = $30,000.
Maintenance Margin Required (MMR)
Maintenance Margin Required is a little trickier to wrap our heads around, but stick with me and I'll do my best.
MMR is the margin you need to maintain to keep the position open.
It's essentially a measure of maximum drawdown, at some point of that trade going into the red, the loss on the position will push the MMR below the threshold, and this is when liquidation occurs.
We can see from the above screenshot that MMR for a 125x leverage position is 0.4%.
0.4% of our $30,000 USD position is $120 USD.
This means we need to maintain a margin value over $120 to keep this position open.
Which means if the unrealised loss on this position exceeds $120 USD ($240 IMR - $120 MMR) we will be liquidated and suffer a realised loss of all our margin for a $240 loss.
You can think of Maintenance Margin as the minimum margin required to keep the position open.
If the Margin used to open the position, minus the loss on that position, becomes less than the Maintenance Margin, a position will be liquidated.
Percentage of Initial Margin Loss that leads to Liquidation (IML)
Personally I find it easiest to think in terms of the percentage of initial margin lost that leads to liquidation.
The Percentage of Margin Loss that leads to Liquidation can actually be calculated directly - without a position size - on certain exchanges such as BitMEX, although we do need a position size on OKX to tell us which tier we fall into and which values to use for IMR and MMR.
To do this we first calculate the minimum margin required to keep the position open as a percentage of our initial margin by dividing the MMR by the IMR.
In the above example, IMR is 0.8% and MMR 0.4% for a percentage of initial margin required to keep our position open of 50% (0.4% MMR / 0.8% IMR)
We can then calculate the percentage of margin loss that leads to liquidation as 1 - [0.4% MMR / 0.8% IMR].
For our example, this is again 50% (1 - 50% = 50%) so we can suffer a 50% drawdown on this position before liquidation will occur.
This checks out with our calculations above, we needed $240 to open the position, and got liquidated if that position lost $120 of margin (50% of IMR), which also reflects our percentage of margin required to keep the position open of $120 ($240 IMR - $120 Unrealised Loss).
We can do the same for a higher number of contracts in a larger position tier:
For a position of 30,000 contracts, our IMR is 2% (Giving us 50x max leverage) and our MMR is 1.25%.
If we use these values for our above position (this ignores OKX's tiers) we would see for our 100 contact, $30,000 USD position we need:
Margin to open position = $600 USD ($30,000 USD Position Value x 2% Initial Margin Required)
Maintenance Margin Required = $375 ($30,000 USD Position Value x 1.25% maintenance Margin Required)
Which leads to a minimum maintenance margin as a percentage of our initial margin of 62.5% (1.25% / 2%)
And a maximum drawdown on our initial margin of 37.5% ( 1 - [1.25% / 2%]).
This means our position needs to maintain a margin above 62.5% (1.25% MMR / 2% IMR) of our initial margin or we risk liquidation, which also means we will be liquidated when the position has an unrealised loss of 37.5% of the initial margin required ( 1 - [1.25% MMR / 2% IMR]).
If we look at that in dollar terms, we see we need to maintain a maintenance margin value of $375 ($600 IMR x 62.5% minimum maintenance margin as a percentage of our initial margin) which matches our MMR as expected.
Which means we have a maximum unrealised loss of $225 ($600 IMR x 37.5% maximum drawdown on initial margin) before we face liquidation.
So we can see that a position that fits tier 1 of less than 1,001 contacts gets liquidated at a 50% loss of initial margin, but a position on that same pair of between 20,001 and 40,000 contracts instead gets liquidated at a 37.5% loss of initial margin.
What does this look like on the charts?
To calculate the percentage price needs to go against us before we're liquidated, we can look at the margin loss that leads to liquidation.
Any percentage of price action movement from entry on the chart will have an effect multiplied by our leverage on our unrealised P&L.
So at 125x, a 1% move will actually give us a 125% unrealised P&L on our initial margin (ignoring the fact we'd be liquidated well before this).
So if
Leverage x Price action percentage = Unrealised P&L
And we know liquidation occurs when Unrealised P&L is equal to ( 1 - [MMR / IMR])
We can calculate what percentage of price action movement will lead to liquidation in our above scenarios using
Liquidation Price action percentage = ( 1 - [MMR / IMR]) / Leverage
So for our 1000 contract example, with a leverage of 125x, IMR = 0.8% and MMR = 0.4% as OKX's position tiers dictate:
Liquidation Price action percentage = ( 1 - [ 0.4% MMR / 0.8% IMR]) / 125x Leverage
Liquidation Price action percentage = 0.4%
This tells us if price moves 0.4% from entry, we will be liquidated.
At $30,000 entry, this means for a long a price of $29,880 (30,000 x [1- 0.4%]) would see OKX liquidating our position.
This checks out with our above example, as our position was 1 BTC worth $30,000 USD and if price has gone down to $29,880 that position of 1BTC is now worth $29,980 - $120 against us, so we'll now be liquidated - notice how the $120 loss matches the value we calculated for the unrealised loss that would lead to liquidation.
We can do the same for our tier 4 trade, again keeping 100 contracts as the position size for simplicity, but using the tier 4 Max Leverage, IMR and MMR values.
Liquidation Price action percentage = ( 1 - [MMR / IMR]) / Leverage
Liquidation Price action percentage = ( 1 - [ 1.25% MMR / 2% IMR]) / 50x Leverage
Liquidation Price action percentage = 0.75%
At $30,000 entry, this means for a long a price of $29,775 (30,000 x [1- 0.75%]) would see OKX liquidating our position.
This checks out with our above example, as our position was 1 BTC worth $30,000 USD and if price has gone down to $29,775 that position of 1BTC is now worth $29,775 - $225 against us, so we'll now be liquidated - notice how the $225 loss matches the value we calculated for the unrealised loss that would lead to liquidation.
So how does VEMA actually Calculate Leverage?
We've seen above how to calculate your liquidation point based on the leverage and position tier your position falls into.
How VEMA calculates leverage is very similar.
First we look at your position size, as this dictates maximum leverage (on some exchanges).
Then we look at your Stop Loss percentage.
Let's say you had a SL of 0.4% on that 100 contract, 125x trade.
This would mean liquidation price and SL price were one and the same (as we calculated that liquidation price falls 0.4% from entry earlier).
But this puts you at risk of liquidation, where instead of losing the $120 your SL would cost you, you'd actually lose $240 - the entire initial margin you used for the trade, doubling your loss.
It's also possible to be liquidated even if your Stop Loss is within the liquidation price, in high slippage events.
If you had a SL of 0.38%, liquidation at 0.4%, and a large candle triggered your SL but price had crossed your liquidation point before that could be filled (slippage) you would be liquidated instead of your SL filling.
So what VEMA does is it adds a buffer to the max leverage.
We'll switch to BitMEX logic here as it's a little simpler, but the idea is the same, I'll also simplify it a little so the numbers won't be exact but it should explain the general idea.
BitMEX typically liquidate positions at a margin loss of around 50% for 100x, or higher for lower leverages.
This is similar to OKX's tier 1 for BTC, with the 0.8% IMR and 0.4% MMR giving a 50% margin loss where liquidation would occur.
So VEMA sets out to make your maximum margin loss less than 40%, meaning at your Stop Loss, you should be at a 40% maximum unrealised P&L.
The formula for this is:
Leverage x Stop Loss % ≤ Buffered Maximum Margin Loss
We know your Stop Loss percentage from your setup, and set the Maximum Margin Loss as 40%, so our leverage calculation becomes
Leverage ≤ Buffered Maximum Margin Loss / Stop Loss %
This gives trades a minimum 20% buffer (40% Maximum Margin Loss at Stop Loss / 50% Minimum Margin loss for liquidation) on their Stop Loss to liquidation price from entry, which helps protect against liquidation in the event of slippage on either entry or exit, at the expense of tying up a little more margin for each trade.
What does this look like in Practice?
Again using BitMEX as the example for it's simplified logic, let's say you take that same 1 BTC trade from $30,000 USD, with a 0.4% SL.
VEMA then uses the above formula to calculate your leverage
Leverage ≤ Buffered Maximum Margin Loss / Stop Loss %
Leverage ≤ 40% Buffered Maximum Margin Loss / 0.4% Stop Loss
Leverage ≤ 100 x
So VEMA would then enter this position at 100x leverage.
This would result in a trade with Entry at $30,000 USD, Stop Loss of 0.4% at $29,880, and liquidation at a minimum value of 50% loss of margin which would occur at $29,850, with BitMEX's liquidation calculator returning a price of $29,853 for that position (The difference being due to our simplified values).
You can see this gives a significant buffer against liquidation, which is something we consider well worth the extra margin tied up to allow for this buffer due to the vastly magnified loss of liquidation when compared to Stop Loss fills (in the above example, doubling the margin lost from $120 to $240).
For OKX the process is similar, except position size first dictates the tier which tells us the maximum leverage available, then the IMR and MMR values for the tier tell us the liquidation point, after which the buffer is applied to give more breathing room between Stop Loss and Liquidation.
Summary
Calculating what leverage a position should use is a complex, math heavy process.
We hope the above explains how and why we use the leverages we do on positions, the fact VEMA does it all for you is just one more way VEMA makes trading easier and more accessible.
Have a great day, and happy trading!
Comments
0 comments
Please sign in to leave a comment.