MetaTrader 5 Help

Margin Calculation: Retail Forex, CFD, Futures

Margin Calculation for Retail Forex, CFD, Futures

The trading platform provides different risk management models, which define the type of pre-trade control. At the moment, the following models are used:

The margin is charged for securing traders' open positions and orders.

The first stage of the margin calculation is defining if an account has positions or pending orders for the symbol, for which a trade is performed.

  • If the account has no positions and orders for the symbol, the margin is calculated using the formulas below.
  • If the account has an open position, and an order of any type with the volume being less or equal to the current position is placed in the opposite direction, the total margin is equal to the current position's one. Example: we have a 1 lot EURUSD Buy position and place an order to Sell 1 lot EURUSD (similarly for Sell Limit, Sell Stop and Sell Stop Limit).
  • If the account has an open position, and an order of any type is placed in the same direction, the total margin is equal to the sum of the current position's and placed order's margins.
  • If the account has an open position, and an order of any type with the volume exceeding the current position is placed in the opposite direction, two margin values are calculated - for the current position and for the placed order. The final margin is taken according to the highest of the two calculated values.
  • If the account has two or more oppositely directed market and limit orders, the margin is calculated for each direction (Buy and Sell). The final margin is taken according to the highest of the two calculated values. For all other order types (Stop and Stop Limit), the margin is summed up (charged for each order).

Below are the symbol margin calculation formulas according to their type and settings. The final margin is calculated in three stages:

Basic Calculation for a Symbol

If "Initial margin" parameter value is set in the symbol specification, this value is used. The formulas described in this section are not applied.

The trading platform provides several margin requirement calculation types depending on the financial instrument. Calculation type is displayed in the "Calculation" field of the symbol specification:

Forex

The margin for the Forex instruments is calculated by the following formula:

Volume in lots * Contract size / Leverage

For example, let's calculate the margin requirements for buying one lot of EURUSD, while the size of one contract is 100,000 and the leverage is 1:100.

Margin calculation for Forex symbols

After placing the appropriate values to the equation, we will obtain the following result:

1 * 100 000 / 100 = 1000 EUR

So, now we have the margin requirements value in base currency (or margin currency) of the symbol.

Generally, margin requirements currency and symbol's base currency are the same. If the margin currency is different, calculation results are displayed in that currency instead of the symbol's base one.

CFD, Exchange Stocks

The margin requirements for CFDs and stocks are calculated using the following equation:

Volume in lots * Contract size * Open market price

The current market Ask price is used for buy deals, while the current Bid price is used for sell ones.

For example, let's calculate the margin requirements for buying one lot of XAUUSD, the size of the contract is 100 units, the current Ask price is 1330 USD.

Margin calculation for CFD and Exchange Stocks

After placing the appropriate values to the equation, we will obtain the following result:

1 * 100 * 1330 = 133,000 USD

So, now we have the margin value in base currency (or margin currency) of the symbol.

CFD Leverage

The leverage is also considered in this type of margin requirement calculation for CFDs:

Volume in lots * Contract size * Open market price / Leverage

CFD Index

For index CFDs, the margin requirements are calculated according to the following equation:

Volume in lots * Contract size * Open market price * Tick price / Tick size

In this formula, the ratio of price and tick size is considered in addition to common CFD calculation.

Margin calculation for CFD Index

Futures, Exchange Futures

There are two types of the margin requirements for futures contracts:

  • Initial margin is the amount that must be available on the account at the moment of attempting to enter the market. Further maintenance of the same sum may not be obligatory.
  • Maintenance margin is the minimum amount that must be available on the account for maintaining an open position.

Both values are specified in the symbol specification.

Margin calculation for Futures and Exchange Futures

The final size of the margin depends on the volume:

Volume in lots * Initial margin

Volume in lots * Maintenance margin

If the amount of the maintenance margin is not specified, the initial margin value is used instead.

FORTS Futures

The margin for the futures contracts of the Moscow Exchange derivative section is calculated as follows:

Buy positions: Margin = Volume * (Buy price - (SettlementPrice - (UpLimit - LowLimit))) * Tick price / Tick size * (1 + 0.01 * Currency margin rate)

Sell positions: Margin = Volume * ((SettlementPrice + (UpLimit - LowLimit)) - Sell price) * Tick price / Tick size * (1 + 0.01 * Currency margin rate)

where:

  • Settlement Price — estimated price of an instrument for the current session
  • UpLimit — maximum price of a contract for the current session
  • LowLimit — minimum price of a contract for the current session
  • Currency margin rate — rate change radius of the currency, a futures contract is denominated in, relative to the Russian ruble.

All the vales above are provided by the Moscow Exchange.

The initial margin specified in the properties of the instruments of this type is indicative. The equations shown here already consider this value:

Initial margin = (UpLimit - LowLimit))) * Tick price / Tick size * (1 + 0.01 * Currency margin rate)

The maintenance margin is equal to the initial one (the field is left blank in the symbol settings).

The discount value is defined in addition to the basic calculation. In certain conditions, the calculated margin minus the discount is charged from the client's account:

  • If a trader places a buy request (position) having the price lower than the last settlement price (last session's settlement price).
  • If a trader places a sell request (position) having the price exceeding the last settlement price (last session's settlement price).

The discount is calculated according to the following equation:

Volume in lots * (Request price - Settlement price)  * Tick price / Tick size

The obtained value (without regard to its positive or negative sign) is subtracted from the margin basic value.

The basic value can be both decreased (by a discount value) and increased. If a buy request is placed at a price higher than the settlement price or a sell request is placed at a price lower than the settlement price, additional margn is charged:

Volume in lots * (Request price - Settlement price)  * Tick price / Tick size

The obtained value (without regard to its positive or negative sign) is added to the margin basic value.

Collateral

Non-tradable instruments of this type are used as trader's assets to provide the required margin for open positions of other instruments. For these instruments the margin is not calculated.

Fixed Margin

If the "Initial margin" field of the symbol specification contains any non-zero value, the margin calculation formulas specified above are not applied (except for the calculation of futures, as everything remains the same there). In this case, for all types of calculations (except for Forex and CFD Leverage), the margin is calculated like for the "Futures" calculation type:

Volume in lots * Initial margin

Volume in lots * Maintenance margin

Calculations of the Forex and CFD Leverage types additionally allow for leverage:

Volume in lots * Initial margin / Leverage

Volume in lots * Maintenance margin / Leverage

If the amount of the maintenance margin is not specified, the initial margin value is used instead.

Converting into Deposit Currency

This stage is common for all calculation types. Conversion of the margin requirements calculated using one of the above-mentioned methods is performed in case their currency is different from the account deposit one.

The current exchange rate of a margin currency to a deposit one is used for conversion. The Ask price is used for buy deals, and the Bid price is used for sell deals.

For example, the basic size of the margin previously calculated for buying one lot of EURUSD is 1000 EUR. If the account deposit currency is USD, the current Ask price of EURUSD pair is used for conversion. For example, if the current rate is 1.2790, the total margin size is 1279 USD.

Margin Rate

The symbol specification allows setting additional multipliers (rates) for the margin requirements depending on the position/order type.

Margin Rate

The final margin requirements value calculated taking into account the conversion into the deposit currency, is additionally multiplied by the appropriate rate.

For example, the previously calculated margin for buying one lot of EURUSD is 1279 USD. This sum is additionally multiplied by the long margin rate. For example, if it is equal to 1.15, the final margin is 1279 * 1.15 = 1470.85 USD.

Calculations for Spread Trading

The margin can be charged on preferential basis in case trading positions are in spread relative to each other. The spread trading is defined as the presence of the oppositely directed positions of correlated symbols. Reduced margin requirements provide more trading opportunities for traders. Configuration of spreads is described in a separate section.

Spreads are only used in the netting system for position accounting.

Calculation in the hedging system of position accounting

If the hedging position accounting system is used, the margin is calculated using the same formulas and principles as described above. However, there are some additional features for multiple positions of the same symbol.

Positions/orders open in the same direction

Their volumes are summed up and the weighted average open price is calculated for them. The resulting values are used for calculating margin by the formula corresponding to the symbol type.

For pending orders (if the margin ratio is non-zero) margin is calculated separately.

Opposite Positions/Orders

Oppositely directed open positions of the same symbol are considered hedged or covered. Two margin calculation methods are possible for such positions. The calculation method is determined by the broker.

Basic calculation

Using the larger leg

Used if "calculate using larger leg" is not specified in the "Hedged margin" field of contract specification.

 

The calculation consists of several steps:

  • For uncovered volume
  • For covered volume (if hedged margin size is specified)
  • For pending orders

The resulting margin value is calculated as the sum of margins calculated at each step.

 

Calculation for uncovered volume

  • Calculation of the total volume of all positions and market orders for each of the legs — buy and sell.
  • Calculation of the weighted average position and market order open price for each leg: (open price of position or order 1 * volume of position or order 1 + ... + open price of position or order N * volume of position or order N) / (volume of position or order 1 + ... + volume of position or order N).
  • Calculation of uncovered volume (smaller leg volume is subtracted from the larger one).
  • The calculated volume and weighted average price are used then to calculate margin by the appropriate formula corresponding to the symbol type.

 

Calculation for covered volume

Used if the "Hedged margin" value is specified in a contract specification. In this case margin is charged for hedged, as well as uncovered volume.

 

If the initial margin is specified for a symbol, the hedged margin is specified as an absolute value (in monetary terms).

 

If the initial margin is not specified (equal to 0), the contract size is specified in the "Hedged" field. The margin is calculated by the appropriate formula in accordance with the type of the financial instrument, using the specified contract size. For example, we have two positions Buy EURUSD 1 lot and Sell EURUSD 1 lot, the contract size is 100,000. If the value of 100,000 is specified in the "Hedged field", the margin for the two positions will be calculated as per 1 lot. If you specify 0, no margin is charged for the hedged (covered) volume.

 

Per each hedged lot of a position, the margin is charged in accordance with the value specified in the "Hedged Margin" field in the contract specification:

  • Calculation of hedged volume for all open positions and market orders (uncovered volume is subtracted from the larger leg).
  • Calculation of the weighted average position and market order open price: (open price of position or order 1 * volume of position or order 1 + ... + open price of position or order N * volume of position or order N) / (volume of position or order 1 + ... + volume of position or order N).
  • The calculated volume, weighted average price and the hedged margin value are used then to calculate margin by the appropriate formula corresponding to the symbol type.

 

Calculation for pending orders

  • Calculation of margin for each pending order type separately (Buy Limit, Sell Limit, etc.).

Used if "calculate using larger leg" is specified in the "Hedged margin" field of contract specification.

  • Calculation of margin for shorter and longer legs for all open positions and market orders.
  • Calculation of margin for each pending order type separately (Buy Limit, Sell Limit, etc.).
  • Summing up a longer leg margin: long positions and market orders + long pending orders.
  • Summing up a shorter leg margin: short positions and market orders + short pending orders.
  • The largest one of all calculated values is used as the final margin value.

Example

The following positions are present:

  • Sell 1 lot at 1.11943
  • Buy 1 lot at 1.11953
  • Sell 1 lot at 1.11943
  • Buy 1 lot at 1.11953
  • Sell 1 lot at 1.11943

Hedged margin size = 100 000. Buy margin rate = 2, for Sell = 4.

 

Calculate hedged volume: Sell volume (3) - Buy volume (2) = 1

Calculate the weighted average Open price for the hedged volume by all positions: (1.11943 * 1+1.11953 * 1+1.11943 * 1+1.11953 * 1+1.11943 * 1)/5 = 5.59735/5= 1.11947

Calculate the weighted average Open price for the non-hedged volume by all positions: (1.11943 * 1 + 1.11943 * 1 + 1.11943 * 1)/3 = 1.11943

Calculate the margin ratio for the hedged volume: (buy ratio + sell ratio)/2 = (2 + 4)2 = 3

The larger leg (sell) margin ratio is used for the non-hedged volume: 4.

Calculate the hedged volume margin using the equation: (2.00 lots * 100000 EUR * 1.11947 * 3) / 500 = 1343.364

Calculate the non-hedged volume margin using the equation: (1.00 lot * 100000 EUR * 1.11943 * 4) / 500 = 895.544

The final margin size: 1343.364 + 895.544 = 2238.91