The trading platform provides different risk management models, which define the type of pretrade 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.
Below are the symbol margin calculation formulas according to their type and settings. The final margin is calculated in three stages:
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:
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.
After placing the appropriate values to the equation, we will obtain the following result:
1 * 100 000 / 100 = 1 000 EUR
So, now we have the margin requirements value in base currency (or margin currency) of the symbol.

This type of calculation is also used for Forex symbols. But unlike the previous one, it does not take into account the trader's leverage:
Volume in lots * Contract size
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. After placing the appropriate values to the equation, we will obtain the following result:
1 * 100 000 = 100 000 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. 
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 #AA, the size of the contract is 100 units, the current Ask price is 33.00 USD.
After placing the appropriate values to the equation, we will obtain the following result:
1 * 100 * 33.00 = 3 300 USD
So, now we have the margin value in base currency (or margin currency) of the symbol.
The leverage is also considered in this type of margin requirement calculation for CFDs:
Volume in lots * Contract size * Open market price / Leverage
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.
There are two types of the margin requirements for futures contracts:
Both values are specified in the symbol specification.
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. 
The margin for the futures contracts of the Moscow Exchange derivative section is calculated separately for each symbol: First, the margin is calculated for the open position and all Buy orders. Then the margin for the same position and all Sell orders is calculated.
MarginBuy = MarginPos + Sum(MarginBuyOrder)
MarginSell = MarginPos + Sum(MarginSellOrder))
The largest one of the calculated values is used as the final margin value for the symbol.
Thus, the same position is used in the calculation of both values. In the first formula (which includes Buy orders), the position margin is calculated as follows:
MarginPos = Volume * (InitialMarginBuy + (Open Price  SettlementPrice) * Tick Price / Tick Size * (1 + 0.01 * Margin Currency Rate))
The volume is used with a positive sign for long positions and with a negative sign for short positions.
In the second formula (which includes Sell orders), the position margin is calculated as follows:
MarginPos = Volume * (InitialMarginSell + (SettlementPrice  Open Price) * Tick Price / Tick Size * (1 + 0.01 * Margin Currency Rate))
The volume is used with a positive sign for short positions and with a negative sign for long positions.
This approach provides the trader a discount on margin, when there is an open position in the opposite direction with respect to the orders placed (the position acts as collateral for orders).
Margin on orders is calculated by the following formulas:
MarginBuyOrder = Volume * (InitialMarginBuy + (Price  SettlementPrice) * Tick price / Tick size * (1 + 0.01 * Margin currency rate))
MarginSellOrder = Volume * (InitialMarginSell + (SettlementPrice  Price) * Tick price / Tick size * (1 + 0.01 * Margin currency rate))
'Price' here depends on the order time and can be equal to:
Other parameters in the formulas:
All these parameters for calculation are provided by the Moscow Exchange.
InitialMarginBuy is written to the "Initial margin" field, InitialMarginSell is written to the "Maintenance Margin" field in symbol properties. 
Calculation example
The below example shows the calculation of margin requirements for the following trading account state:
Current session parameters
We substitute the values in the formulas
MarginBuy = 3 * (7665.41 + (73640  73638) * 1/1) + 2 * (7665.41 + (7300073638) * 1/1) = 37057.05
MarginSell = 3 * (7739.59 + (7363873640) * 1/1) +10.0 * (7739.59 + (7363874500) * 1/1) = 45563.13
Margin = Max(37057.05, 45563.13) = 45563.13
The resulting margin for the Si6.18 symbol is 45563.13.
Nontradable 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.
If the "Initial margin" field of the symbol specification contains any nonzero 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. 
This stage is common for all calculation types. Conversion of the margin requirements calculated using one of the abovementioned 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.
The symbol specification allows setting additional multipliers (rates) for the margin requirements depending on the position/order type.
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.
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. 
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.
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 nonzero) margin is calculated separately.
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:
The resulting margin value is calculated as the sum of margins calculated at each step.
Calculation for uncovered volume
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 for pending orders
Calculation specifics for hedging orders when using fixed margin When an order opposite to an existing position is placed, the margin on the hedged volume is always calculated using the "Hedge margin" value. For the nonhedged volume, the "Initial margin" value is used when placing an order, and "Maintenance margin" is applied after the appropriate position is opened. These calculation specifics only apply for symbols, for which the initial and maintenance margin values are specified (calculation type "Fixed margin" or "Futures"). For example, the following parameters are used for EURUSD:
A trader has a position Buy 1.00 BR12.18 on a USD account. A margin of 500 USD (as per the "Maintenance margin") is reserved on the trader's account for this position.

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

Example The following positions are present:
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 nonhedged 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 nonhedged volume: 4. Calculate the hedged volume margin using the equation: (2.00 lots * 100000 EUR * 1.11947 * 3) / 500 = 1343.36 Calculate the nonhedged volume margin using the equation: (1.00 lot * 100000 EUR * 1.11943 * 4) / 500 = 895.54 The final margin size: 1343.364 + 895.544 = 2238.90 
