How to calculate leverage adjusted lot size ?.

 

Lot size = Risk Money / (Stop Loss Distance * Tick Value)

This formula retrieves the lot size. Since Price levels are same and tick values are same for every broker that lot size is the common lot size. But the required margin for that lot size could be different due to the leverage of the trading account. 

example -: 

if you do calculate the lot size in regular way, the calculation formula is returning the same lot size (ex - 03 lots) for the 1:500 leveraged broker and for the 1:100 leveraged broker. because the tick value of the symbol is always same for every broker. but you may be able to open 03 lots trade on 1:500 broker but not be able to open 03 lot trade in 1:100 leveraged broker due to insufficient margin

That is the question. How to calculate leverage adjusted lot size?

so even the price levels are same for two different brokers, the lot size will be different due to leverage. 


Honestly, I tried so many formulas. none of them calculate the leverage adjusted lot size. :(

 

Usually, lot size should be calculated based on SL distance, tick value and the amount of money you want to risk.

Leverage or margin is out of this equation because it do not changes the potential loss, but only the required margin.

It comes from itself, that on a lower leverage account, you need to decrease your "risk money".

If you want it to be automatical, you can simply multiply your obtained lot size * (AccountLeverage / 500), so based on your example, in 1:100 account you will have lot size 5 times less than on 1:500 account.

 

Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% account total.

  1. You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce, the stop goes below the support. Then you compute your lot size.

  2. AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/PIP, but it takes account of the exchange rates of the pair vs. your account currency.)

  3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
              MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum (2017)
              Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
              Lot value calculation off by a factor of 100 - MQL5 programming forum (2019)

  4. You must normalize lots properly and check against min and max.

  5. You must also check Free Margin to avoid stop out

  6. For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)

Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.

 

The fixed variable under your control is the "amount of money" you can lose: i.e., = SL distance * PipValue * LotSize.

Leverage has nothing to to do with the amount of lost money at all. You can lose the same money whether non-leveraged or with 1:100 leverage or 1:500 leverage. Or, even you can lose less money with 1:500 leverage than 1:100 leverage by decreasing lotsize or SL distance.

Leverage means the "deposit" money that is reserved to control the same LotSize in the above equation. Leverage only determines the required margin to control that position size.

For whatever LotSize, you must have enough funds (margin) for it. You account balance should cover both the potential loss (usually 2% of balance) + required margin.

If required margin > balance: you must decrease LotSize (and probably increase SL distance).

 

You have two options:

1. Forget about leverage in the formula, and calculate a lot size based on risk percentage of the account and the monetary stop loss value (which is the common accepted way of calculating lots out of risk)

Smaller SL: The lot size is larger because the risk per pip is lower.

Larger SL: The lot size is smaller because the risk per pip is higher.


2. Forget about stop loss in the formula, and calculate a lot size based on risk percentage of the account and leverage.


I have working formulas for both if you still need help with that.

 
amrali #:

Or, even you can lose less money with 1:500 leverage than 1:100 leverage by decreasing lotsize or SL distance.

This is an ironic thing to say, because decreasing SL distance is oftentimes going to make it more likely to be hit. You lose more money with a narrow stop 9/10 times, and you do not lose less money over the long run.
Let's get into reality here where institutional tactics are at play liquidating all those narrow stop loss positions with a tactic known as "stop hunting".
This is why I believe the component of monetary stop loss in the calculation of lots really isn't that solid of an idea to begin with. There's no good logic in it and there never was. Account risk is the main thing that matters.
 
Fabio Cavalloni #:

Usually, lot size should be calculated based on SL distance, tick value and the amount of money you want to risk.

Leverage or margin is out of this equation because it do not changes the potential loss, but only the required margin.

It comes from itself, that on a lower leverage account, you need to decrease your "risk money".

If you want it to be automatical, you can simply multiply your obtained lot size * (AccountLeverage / 500), so based on your example, in 1:100 account you will have lot size 5 times less than on 1:500 account.

This looks like an adequate answer, just one note should be made that many symbols do usually have specific leverages other than account leverage. Also using magic numbers like 100 or 500 may not work well in all conditions.

Actually it's not clear enough how exactly OP wanted to handle both stop loss and margin related risks. Here is some options. It's assumed here that Money is replaced by Free Margin, because we can't risk money which is already frozen, so original formula looks like this:

Lot size = Risk * Free Margin / (Stop Loss Distance * Point Value)

To adjust the lot by required margin we could recalculate it (once seems enough):

Lot size = Risk * (Free Margin - Margin Required For (Lot size)) / (Stop Loss Distance * Point Value)

OR we could adjust the lot linearly:

Lot size *= (1 - Margin Required For (Lot size) / Free Margin)

OR we coould calculate lot size by margin apart and then choose the smaller value:

Lot size by margin = Risk * Free Margin / Margin Required For 1 lot
Actual lot = min(Lot size, Lot size by margin)

This way the risk is the same for stop loss or stop out events.

 
Stanislav Korotky #:

This looks like an adequate answer, just one note should be made that many symbols do usually have specific leverages other than account leverage. Also using magic numbers like 100 or 500 may not work well in all conditions.

Actually it's not clear enough how exactly OP wanted to handle both stop loss and margin related risks. Here is some options. It's assumed here that Money is replaced by Free Margin, because we can't risk money which is already frozen, so original formula looks like this:

To adjust the lot by required margin we could recalculate it (once seems enough):

OR we could adjust the lot linearly:

OR we coould calculate lot size by margin apart and then choose the smaller value:

This way the risk is the same for stop loss or stop out events.

I don't see the pertinence to mix the different risks. I would even say it's a bad idea.

The premise of the OP to open a trade in all cases (bypassing the "not enough margin" using a standard risk calculation) seems wrong to me.

You calculate your risk from the SL, then you check your margin requirements (taking into account the SL could be hit), if you don't have enough margin you don't trade, that's it.

If you trade more because you are using a more leveraged account (1:500 instead of 1:100 for example), you are over-trading.

 
Alain Verleyen #:

I don't see the pertinence to mix the different risks. I would even say it's a bad idea.

The premise of the OP to open a trade in all cases (bypassing the "not enough margin" using a standard risk calculation) seems wrong to me.

You calculate your risk from the SL, then you check your margin requirements (taking into account the SL could be hit), if you don't have enough margin you don't trade, that's it.

If you trade more because you are using a more leveraged account (1:500 instead of 1:100 for example), you are over-trading.

All my variants make lot size smaller (than it's calculated solely by stop loss distance) with correction by required margin - seems fair for me, over-trading is eliminated.

I don't have impression, that OP means what you said (in yellow) - AFAICU, he wanted to adjust lot size by both factors, but probably I missed his point.

 
Alain Verleyen #:

I don't see the pertinence to mix the different risks. I would even say it's a bad idea.

That's questionable, imho. The more risks are taking into account the better. The fact that risk percentage is choosen equal for stop loss and margin is just a simplification for this example.

Alain Verleyen #:

If you trade more because you are using a more leveraged account (1:500 instead of 1:100 for example), you are over-trading.

Larger leverage means smaller exposure, hence you can enlarge the lot if you keep correct calculations for potential losses, don't you?