You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everybody,
I am trying to find out the exact formula allowing to compute the required margin to open a trade, given a certain size (especially for what regards metals). I already looked around the web and forum's topics and I found examples. Unfortunately all of them, in some cases, does not show the same results MT4 provides. I briefly recap my actual understandings. The needed inputs to compute the required margin are:
- Account Leverage, the contract size, the trade volume, and the base account currencies ratio.
So, if I wish to buy 1 lot of XAUUSD (gold) at the price 1250.247 having as account currency $, the formula shall be:
Req Margin = 1 * MarketInfo("XAUUSD", MODE_LOTSIZE) * 1250.247 / AccountsLeverage() = 1 * 100 * 1250.247 / 20 = 6251,235
the above result is already available in MT4 through MarketInfo("XAUUSD", MODE_MARGINREQUIRED), but that method returns 5653.7, which is quite different from the one provided by the formula.
Does someone understand where I'm wrong?
Many thanks to any replies