Download MetaTrader 5

calculating required margin?

To add comments, please log in or register
samusmus1
321
samusmus1  

How can I calculate the required margin?


Required Margin = Trade Size / Leverage * account currency exchange rate (if different from the base currency of the pair traded)



How to calculate 'margin' for a trade + margin for 45 pip SL?


Before I open a trade, I think I need to collect this info:

- Lotsize (1 lot),

- leverage (500:1),

- pips of SL (45),

- current free margin

- account currency (euro)

- currency pair (EUR/USD)


I have read below text, but I can' t figure out how to calculate it with my example?

Required Margin = Trade Size / Leverage * account currency exchange rate (if different from the base currency of the pair traded)

Example:

Trading 3 lots of EUR/USD using 1:200 leverage with an account denominated in USD.
Trade size: 300,000
Account currency exchange rate: 1.13798
Required Margin: 300,000 / 200 * 1.13798 = $1706.97
For metals, the margin calculation works as follows:

Required Margin = Trade Size (0z) / Leverage * Market Price

Example:

Trading 1 lot (100 Oz) of GOLD using 1:200 leverage with an account denominated in USD.
Trade size = 100 Oz
Market price = 1235.90
Required Margin: 100 / 200 * 1235.90 = $617.95


Simple calculation and result (but it' s not correct):

1 lot = approx. 250 euro margin

1 lot on 45 pips = approx. 450 euro

So total is 250 + 450 = requires 700 euro margin.

whroeder1
17050
whroeder1  
samusmus1: How can I calculate the required margin?

It's not margin to open. It's the remaining margin at most adverse excursion of all open and the new, orders.

Risk depends on your initial stop loss, lot size, and the value of the pair.

  • 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.
  • Account Balance * 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.)
  • 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 (EUR, in this case).
              MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
  • You must normalize lots properly and check against min and max.
  • You must also check FreeMargin to avoid stop out
Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5=0.1 Lots maximum.
samusmus1
321
samusmus1  
Before I open a trade, I think I need to collect this info:

- Lotsize (1 lot),

- leverage (500:1),

- pips of SL (45),

- current free margin (5.000 euro)


- currency pair (EUR/USD)

- currency exchange rate: 1.13798 

100,000/500 * 1.13798 = 227,60 euro

Now I have all the info. How do I calculate the required margin if my order hits StopLoss?

samusmus1
321
samusmus1  

If I drag  filled_price to SL_price in MetaTrader4 for 1 lot. Then it says: around 450 euro. (this  means: if order hits SL 45 pips on 1 Lot, then I lose 450 euro).



I want to know how to calculate this ' 450 euro'  myself. How do I get 450 euro by calculating?




So: How to calculate how much euro I lose if order hits StopLoss?




Pips at risk * pip value * position size =


45            * $ 10               * 100.000 = 45 million dollar at risk? What am I doing wrong?

How to Calculate Pip Value For Any Forex Pair or Account Currency
How to Calculate Pip Value For Any Forex Pair or Account Currency
  • www.thebalance.com
In forex trading, pip value can be a confusing topic. A pip is a unit of measurement for currency movement. A pip is the fourth decimal place in most currency pairs. For example, if the EUR/USD moves from 1.1015 to 1.1016, that's a one pip movement. Most brokers provide fractional pip pricing, so you'll also see a fifth decimal place such as...
Fernando Carreiro
3951
Fernando Carreiro  
samusmus1: If I drag  filled_price to SL_price in MetaTrader4 for 1 lot. Then it says: around 450 euro. (this  means: if order hits SL 45 pips on 1 Lot, then I lose 450 euro).

I want to know how to calculate this ' 450 euro'  myself. How do I get 450 euro by calculating?

So: How to calculate how much euro I lose if order hits StopLoss?

Pips at risk * pip value * position size =

45            * $ 10               * 100.000 = 45 million dollar at risk? What am I doing wrong?

You have already been answered by @whroeder1 in his post #1.

Don't just ignore it. Read it attentively, including all the links he has provided for you!

samusmus1
321
samusmus1  
Fernando Carreiro:

You have already been answered by @whroeder1 in his post #1.

Don't just ignore it. Read it attentively, including all the links he has provided for you!


@Fernando: thank you. I will.

@whroeder1: 

  • 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.
OK. SL is 45 pips.
  • Account Balance * 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.)

First, I need the calculation for Commission Per Lot:

100,000/100,000* 1 lots= 5 * price/commission

commission = (5 * 100,000 * 1 lots * 1.13798)/100,000 

commission = 0.005/100 * 100,000 * 1 lot * 1.13798 = 5,6899


Then:

OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot

100,000 * 0.0045 * 10 * 5.6899 = 25604.55 dollar //this is the margin if a trade opens with 1 lot.

--> unfortunately this cannot be the right result. What am I doing wrong?


Ok. 
Ok. 
  • You must also check FreeMargin to avoid stop out

Ok.




What do I still need to know?


I still need to know how to calculate exactly:

227,60 dollar margin + 450 dollar SL = 677.60 dollar ?   //this is the total margin required for new trade. //this is the Total Required Margin = 677.60 dollar ;


And once calculated, I can finally compare free margin with Total Required Margin. 

Symbol Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
Symbol Properties - Environment State - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL...
whroeder1
17050
whroeder1  
samusmus1: First, I need the calculation for Commission Per Lot:
No such calculation. It is what your broker charges (if any.)
Alain Verleyen
Moderator
35039
Alain Verleyen  
samusmus1:

...

First, I need the calculation for Commission Per Lot:

...

Then:

OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot

...

--> unfortunately this cannot be the right result. What am I doing wrong? 

You are mixing all.

The margin is not directly related to the SL or openprice, it's related to the lotsize (and lot type:standard,mini,micro), the leverage and the symbol traded.

There is no such thing as "total margin" for a trade, there is a margin (required) and that's all.

Commission has nothing to do here.

Once it's clear, just apply the formula from your first post.


Beside that you can calculate your lotsize from the risk you want to accept for a trade, so from the stoploss distance (45 pips in your example). You can eventually include the commission in your calculation.


And yet beside that you can calculated your global risk, avoid to be stopped out, etc...but you should start by the 2 above points.

To add comments, please log in or register