Errors, bugs, questions - page 3024

 
traveller00:

SymbolInfoMarginRate ? And count the margin by hand, something like.

Tried it. Doesn't always help.

 
fxsaber:

How do I get the value of this field in MT5 that I can see in MT4?


Share the function that always produces the correct margin value. OrderCalcMargin lies, unfortunately. This is not the panacea.

Is this field available in mql4?

 
Alexey Viktorov:

Is this field available in mql4?

Not directly, no.

 
fxsaber:

Not directly, no.

Not direct is also a pain in the ass...

Why doesn't SymbolInfoMarginRate always help?

 
Alexey Viktorov:

Why doesn't SymbolInfoMarginRate always work?

This script gives out 1000.

void OnStart()
{
  Alert(GetMarginRequired(_Symbol)); // https://www.mql5.com/ru/forum/170952/page9#comment_4134898
}

It should give out 2000.

 

There's another trick with margin in MT5.

I do not understand why ACCOUNT_MARGIN_LEVEL is so wrongly calculated.

 
How comeACCOUNT_LEVERAGE ended up inENUM_ACCOUNT_INFO_INTEGER and not inENUM_ACCOUNT_INFO_DOUBLE?
 
fxsaber:
How comeACCOUNT_LEVERAGE is inENUM_ACCOUNT_INFO_INTEGER and not inENUM_ACCOUNT_INFO_DOUBLE?

It's leverage. The level of margin is something else entirely. I can't tell from memory how it's counted, but it's not the same.

I think 999.17 is

ACCOUNT_MARGIN_LEVEL

Account margin level as a percentage

double

 
fxsaber:

This script gives out 1,000.

It's supposed to give 2,000.

And if you multiply by the initiation margin, from the snapshot in the next post, you get exactly 2000

 

2940