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
Or type 0.5
I have a problem with the followng contract.
If I Print MARGINREQUIRED I see 92.15 but if I try to open 1 Lot the required margin is around 2K Euros.
Could you help me to calculate the required margin for a given size?
I tried the following
Required Margin = Volume * Contract Size * Open Price * Margin %
but I seem it doens't work (may be for CFD leverage?)
I have a problem with the followng contract.
If I Print MARGINREQUIRED I see 92.15 but if I try to open 1 Lot the required margin is around 2K Euros.
Could you help me to calculate the required margin for a given size?
I tried the following
Required Margin = Volume * Contract Size * Open Price * Margin %
but I seem it doens't work (may be for CFD leverage?)
I tried to sold 0.45 lots of the contract and I saw the required margin was Euro 404.
Using the following formula
Margin: (Lots * ContractSize * MarketPrice) / Leverage * Margin_Rate
I obtain ((0.45 *100 * 101.187/100) / 100 * 100%) / EURUSD = 41.39
Where is my error?
I tried to sold 0.45 lots of the contract and I saw the required margin was Euro 404.
Using the following formula
Margin: (Lots * ContractSize * MarketPrice) / Leverage * Margin_Rate
I obtain ((0.45 *100 * 101.187/100) / 100 * 100%) / EURUSD = 41.39
Where is my error?
Is there a way to recall the margin % from code?
For some contracts it's available under Margin rate, at the bottom of the window. So if Margin rate is 5, I need to divide by 20.
Is there a way to recall the margin % from code?
For some contracts it's available under Margin rate, at the bottom of the window. So if Margin rate is 5, I need to divide by 20.
Yes, SymbolInfoDouble with SYMBOL_MARGIN_INITIAL
Just a heads up: SYMBOL_MARGIN_INITIAL gives you the actual margin amount for one lot, not the percentage. If you’re looking for that “Margin rate” you see at the bottom of the symbol window, you’ll have to calculate it like this:
MarginPercent = (MarginInitial / (ContractSize * Price)) * 100 .
But if you’re trading Forex, a simpler way is to grab the account leverage with AccountInfoInteger(ACCOUNT_LEVERAGE) and then the percentage is just 100 / Leverage . For CFDs and futures it might be different, but for most currency pairs that works.
Unfortunately, there’s no direct MQL function to fetch that exact “Margin rate” value shown in Market Watch you have to compute it manually.