Margin Calculation Documentation Question

 

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 :

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?
 
Interesting issue. I haven't found it either.
 
How to get the percentage ?
 
AFAIK, it's determined by your broker.
 
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