Download MetaTrader 5

Margin Calculation Documentation Question

To add comments, please log in or register
fxinternals
13
fxinternals  

In the MQL5 help file we see the following table documenting how margin is calculated for each type of instrument:

 

ENUM_SYMBOL_CALC_MODE

Identifier

Description

Formula

SYMBOL_CALC_MODE_FOREX

Forex mode - calculation of profit and margin for Forex

Margin:  Lots*Contract_Size/Leverage

Profit:   (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFD

CFD mode - calculation of margin and profit for CFD

Margin: Lots *ContractSize*MarketPrice*Percentage/100

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_FUTURES

Futures mode - calculation of margin and profit for futures

Margin: Lots *InitialMargin*Percentage/100

Profit:  (close_price-open_price)*TickPrice/TickSize*Lots

SYMBOL_CALC_MODE_CFDINDEX

CFD index mode - calculation of margin and profit for CFD by indexes

Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDLEVERAGE

CFD Leverage mode - calculation of margin and profit for CFD at leverage trading

Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage

Profit:  (close_price-open_price)*Contract_Size*Lots

 I have searched high and low, and cannot find a way to determine what the instrument's Percentage is.  What call is made, with what enum to get this value?

 

Thanks! 

 
fxinternals
13
fxinternals  
fxinternals :

In the MQL5 help file we see the following table documenting how margin is calculated for each type of instrument:

 

ENUM_SYMBOL_CALC_MODE

Identifier

Description

Formula

SYMBOL_CALC_MODE_FOREX

Forex mode - calculation of profit and margin for Forex

Margin:  Lots*Contract_Size/Leverage

Profit:   (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFD

CFD mode - calculation of margin and profit for CFD

Margin: Lots *ContractSize*MarketPrice*Percentage/100

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_FUTURES

Futures mode - calculation of margin and profit for futures

Margin: Lots *InitialMargin*Percentage/100

Profit:  (close_price-open_price)*TickPrice/TickSize*Lots

SYMBOL_CALC_MODE_CFDINDEX

CFD index mode - calculation of margin and profit for CFD by indexes

Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDLEVERAGE

CFD Leverage mode - calculation of margin and profit for CFD at leverage trading

Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage

Profit:  (close_price-open_price)*Contract_Size*Lots

 I have searched high and low, and cannot find a way to determine what the instrument's Percentage is.  What call is made, with what enum to get this value?

 

Thanks! 

 


Also, where canyou get the futures Initial Margin amt?
Arturo Lopez Perez
165678
Arturo Lopez Perez  
Interesting issue. I haven't found it either.
waza123
125
waza123  
How to get the percentage ?
Alain Verleyen
Moderator
32409
Alain Verleyen  
AFAIK, it's determined by your broker.
waza123
125
waza123  
Alain Verleyen:
AFAIK, it's determined by your broker.

any function to get that value with mql4 ?


this function: MarketInfo(Symbol(), MODE_MARGINREQUIRED)

returns: 0 , if

 MarketInfo(Symbol(), MODE_MARGINCALCMODE) == 1

To add comments, please log in or register