margin calculation for a symbol that has different leverage than ACCOUNT_LEVERAGE

 

Hi,

I have encountered an interesting issue - my live account with a particular broker has 1:30 leverage (and that's also what ACCOUNT_LEVERAGE property says), but for some instrument types (cryptocurrency-based CFDs, e.g. BTCUSD) the leverage is reduced to 1:2 instead of 1:30.

Nevertheless, when I am using OrderCalcMargin function to calculate the margin for 1 lot of BTCUSD, it provides a margin value as if BTCUSD had 1:30 leverage as all other instruments - which is obviously wrong, as it has 1:2.

Any ideas how to handle it, except hardcoding an equation for margin calculation instead of using OrderCalcMargin function? 

 
Pawel Wojnarowski:

Hi,

I have encountered an interesting issue - my live account with a particular broker has 1:30 leverage (and that's also what ACCOUNT_LEVERAGE property says), but for some instrument types (cryptocurrency-based CFDs, e.g. BTCUSD) the leverage is reduced to 1:2 instead of 1:30.

Nevertheless, when I am using OrderCalcMargin function to calculate the margin for 1 lot of BTCUSD, it provides a margin value as if BTCUSD had 1:30 leverage as all other instruments - which is obviously wrong, as it has 1:2.

Any ideas how to handle it, except hardcoding an equation for margin calculation instead of using OrderCalcMargin function? 

You do have to hard code it, unless newer version of MT5 has leverage at symbol properties level, not sure since i am still on 2085.

Maybe this https://www.mql5.com/en/forum/271388 thread will help somewhat.

 
Thanks, that what I have expected. I have newest one (2280) and still the same. Seems that it's not only me that's waiting for SYMBOL_LEVERAGE property introduction :)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Path to the file of an image that will be used as an icon of the EX5 program. Path specification rules are the same as for resources. The property must be specified in the main module with the MQL5 source code. The icon file must be in the ICO format. When launching a script or an Expert Advisor on the chart, the stack of at least 8 MB is...