There's no need to know the used margin. Before you open a new order, you need to know the free margin at SL (of all open orders and the order you are about to open) to avoid a possible margin call (stop out.)
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent = RISK = |OrderOpenPrice - OrderStopLoss| * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
WHRoeder:
There's no need to know the used margin. Before you open a new order, you need to know the free margin at SL (of all open orders and the order you are about to open) to avoid a possible margin call (stop out.)
Dear WHRoeder, Thanks for your suggestion. However, you can see my purpose is how to understand the precision of Margin and Profit calculating.
Do you have any idea how to calculate them precisely? Thanks.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
It's not easy to see the used Margin of an order if there are a few orders opened.
1. Is there a simple way to get the used Margin of an order?
2. If there is a short order of "Eur/Gbp" and my account money is "Usd", should I use the bid or ask price of "Eur/Usd" to calculate the used margin?
3. If there is a long order of "Eur/Gbp" and my account money is "Usd", should I use the bid or ask price of "Eur/Usd" to calculate the used margin?
4. Whatever long or short, the margin is calculated based on the price of "Eur/Usd" at the time when the order is open. Right?
How to understand the precision of the profit/loss calculation below?
1. If closing a short order of "Eur/Gbp" and my account money is "Usd", should I use the bid or ask price of "Gbp/Usd" to calculate the profit/loss?
2. If closing a long order of "Eur/Gbp" and my account money is "Usd", should I use the bid or ask price of "Gbp/Usd" to calculate the profit/loss?
3. Whatever long or short, the profit is calculated based on the price of "Gbp/Usd" at the time when the order is being closed. Right? Or when the order is open?