Margin and Free Margin incorrect when 2 orders are open?

 

I was trying to verify (in Excel) my understanding of how MT4 computes the values shown in the Terminal window, such as Margin, Free Margin, Margin Level, etc. and I noticed something weird. Here's the summary, details are below with screenshot and my calculations in Excel attached:

  • Step 1. Opened a EURUSD trade SELL and calculated Profit, Margin, Free Margin and Margin Level. All my calculations matched MT4's.
  • Step 2. Opened a USDCHF trade BUY of 1 (one) Lot. I expected the used Margin to go up by 200 USD (acct curr is USD and Leverage is 1:500). But it DID NOT! MT4 showed some strange value for the margin!
  • Step 3. Closed trade #1 (the EURUSD SELL). All values, again, were ok and the used Margin is now $200, as it should be!

So what am I missing here? Obviously I can calculate correctly the used margin for each of the two trades. Why is the used margin NOT equal to the sum of the margins of each of the trades?


= = = Screenshots = = =

Step 1

Step2

Step 3

= = =


NOTE: Rename the attached file MarginCalcs.xls.TXT to MarginCalcs.xls to open it in Excel or OpenOffice...

Files:
 

This a demo account on server "AlpariUK-Demo - Micro+Classic" with leverage 1:500...

I will provide username and passsword if anybody wants to solve this mistery and needs account access...

 
More Info:

1. The problem is reproducible - I am observing it again in the same demo account. I am not putting the login and password here only because I am concerned that people will start playing with the account and may mess things such that it would not be possible to reproduce the problem. I will gladly provide the loginn info to RaptorUK (or any other responsible and knowledgable individual for that matter, just provide some private channel for communication so I can send it to you... and pls do not open any new trades :)).

2. The problem seems to be happening when one of the trades is BIG (many lots). Initially I had 22.09 lots open and now I have 23 Lots open and it is happening).

3. This may be related to the problem... this whole thing started because I was trying to verify that the platform would not let me open trades above the account stopout level. So I made some calculations and tired to open a trade which was just below my account stopout level (20%) and MT4 would not let me. I started decreasing the number of lots until it eventually did allow the trade and that's how that first trade was opened (the 22.09 lots or EURUSD, Step 1). I left it open overnight coz I thought that at some point the trade would go bad and I would be stopped out and I wanted to see when and how that would happen... but it did not happen... :)
 
4x4ever:
More Info:

1. The problem is reproducible [...]

I would ask Alpari.

They have floating leverage, and the margin usage may be different to the headline AccountLeverage() reported in MT4. In theory, this should only come into effect with open positions > 30 lots, but the possible explanations include the margin calculation simply being wrong.

 
gchrmt4:

I would ask Alpari.

Thank you gchrmt4 .. I might do that ... though I have not had big success in my previous communication with Alpari.

I was also wondering whether you can see the problem from what I posted and agree with me that Margin does look incorrect in Step 2? It should have been 5990.76 + 200 = 6190.76 but it is 6476.91... I realize that you may have commented just to point me in direction of contacting Alpari, without going into the depth of my calculations and that's fine... just wondering if anybody else sees a problem here or it's just me :)

 
4x4ever:

Thank you gchrmt4 .. I might do that ... though I have not had big success in my previous communication with Alpari.

I was also wondering whether you can see the problem from what I posted and agree with me that Margin does look incorrect in Step 2? It should have been 5990.76 + 200 = 6190.76 but it is 6476.91... I realize that you may have commented just to point me in direction of contacting Alpari, without going into the depth of my calculations and that's fine... just wondering if anybody else sees a problem here or it's just me :)

I have looked at your calculation, and I also cannot see an error. In particular, as you say, there is no obvious reason why the margin usage of the two open positions is not the sum of the margin usage of each separate open position.
 

Ok so I did contact ALpari and it went better than I expected, hehe - I got an answer to my question WHY the Margin calculation appears wrong...

So the reason why the margin displayed in MT4 is bigger than what I initially calculated is because Alpari uses "Floating Leverage". Details here: https://alpari.com/products/floating-leverage, but what this basically means is that your Leverage gradually increases when you open big positions:

So in my case the first 3 Million USD worth of my position are opened at a 1:500 leverage and the next 2 Million are at 1:200,

so...

23 Lots or EURUSD opened at 1.35378 are equal to 3,113,694 USD. The margin for the first 3 Mil is 3M / 500 = 6,000 USD. The margin for the remaining 113,694 is 113,694/200=568.47.

And the smaller positions which I opened after that are also computed at 1:200 leverage.

- - -

Ok, great, so now I know why this is happening... if only I could come up with a SOLUTION or at least some workaround for this problem... Because AccountLeverage still returns 500, even when you are over the 3 million mark. Would that be a problem with MT4? Should it not return 200 at that point?

 
4x4ever:


Ok, great, so now I know why this is happening... if only I could come up with a SOLUTION or at least some workaround for this problem... Because AccountLeverage still returns 500, even when you are over the 3 million mark. Would that be a problem with MT4? Should it not return 200 at that point?

Yes it should . . . there are other such anomalies where what is documented does not match what actually happens . . . and MetaQuotes don't want to do anything about it.
 

So what can I do...?


If ( AccountCompany() == "Alpari" ) Then

Jump through hoops when calculating Leverage, Margin, FreeMargin, StopoutLevel and God knows what else?


Sounds like a horrible hack... and there's probably other companies out there that use floating leverage?

 
4x4ever:

So what can I do...?

There are probably many options:

  • don't use Brokers that use floating leverage
  • hard code min offered leverage and use this as a worst case for Brokers that offer floating leverage
  • ask MetaQuotes for the correct procedure for this situation - Service Desk
  • other . .

 

RaptorUK:

...

  • ask MetaQuotes for the correct procedure for this situation - Service Desk


I am unable to follow the procedure you describe in this link to get to the Service Desk. I go to my profile but there is no Service Desk link there... Do I need some special access or special account to see the Service Desk link?
Reason: