Download MetaTrader 5

How the margin requirements for a symbol are calculated

To add comments, please log in or register
aknetmma
48
aknetmma  
While checking the Documentation of the Symbol Properties I noticed the formulas for margin and profit calculation.

SYMBOL_CALC_MODE_FOREX
Margin:  Lots*Contract_Size/Leverage
Profit:   (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_FUTURES
Margin: Lots *InitialMargin*Percentage/100
Profit:  (close_price-open_price)*TickPrice/TickSize*Lots

SYMBOL_CALC_MODE_CFD
Margin: Lots *ContractSize*MarketPrice*Percentage/100
Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDINDEX
Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize
Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDLEVERAGE
Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage
Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_EXCH_STOCKS
Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage
Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_EXCH_FUTURES
Margin: Lots*InitialMargin or Lots*MaintenanceMargin
Profit:  (close_price-open_price)*Lots*TickPrice/TickSize

SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS
Margin: Lots*InitialMargin or Lots*MaintenanceMargin
Profit:  (close_price-open_price)*Lots*TickPrice/TickSize

SYMBOL_CALC_MODE_SERV_COLLATERAL
Margin: no
Profit:  no
Market Value: Lots*ContractSize*MarketPrice*LiqudityRate

How I get the values for :
MarketPrice -  Is it the ask or bid according to the opened position?
TickPrice - Is it Tick Value?
Margin Initial and Margin Maintenance - Which margins are those, the Margin Rates?
Percentage
Liquidity Rate

What functions should I use?
To add comments, please log in or register