1. Hedged and uncovered volume
For opposing positions on the same symbol in a hedging account, let B and S be total buy and sell lots. H = min(B,S); U = |B−S|. Buy 0.10 and sell 0.08 lots give H = 0.08 and U = 0.02 lots.
2. Basic method
Under constant per-lot rates, M = H × Mh + U × Mn. Assume hedged margin Mh = USD 100 per lot and normal margin Mn = USD 1,000 per lot. M = 0.08 × 100 + 0.02 × 1,000 = USD 28.
3. Larger Leg method
With identical constant rates on both sides, M = max(B × Mn, S × Mn) = max(100,80) = USD 100.
4. Comparison
The larger-leg margin is approximately 3.57 times the basic margin in this hypothetical example.
| Metric | Basic | Larger Leg |
|---|---|---|
| Used Margin | $28 | $100 |
| Margin Level (Equity $200) | 714.29% | 200% |
| Free Margin | $172 | $100 |
5. Stop-out risk
Equal opposing volumes reduce directional exposure but do not erase existing losses. Spread expansion, commissions, swaps, margin changes and closing one side can affect equity or margin. At constant used margin USD 100, equity falling from USD 200 to USD 50 changes margin level from 200% to 50%. Stop-out depends on broker thresholds and calculation mode.
6. MQL5 properties
SYMBOL_MARGIN_HEDGED is not necessarily a monetary amount per lot. Its meaning depends on symbol configuration. OrderCalcMargin() excludes existing positions and pending orders; it is not a portfolio margin estimate.
SYMBOL_MARGIN_HEDGEDSYMBOL_MARGIN_HEDGED_USE_LEGACCOUNT_MARGINACCOUNT_MARGIN_FREEACCOUNT_MARGIN_LEVELACCOUNT_MARGIN_SO_SOACCOUNT_MARGIN_SO_MODE
7. Engineering validation
Test additions, partial closures, wider spreads and margin changes in a non-real-money environment. Compare actual account metrics with broker specifications. This simplified model excludes pending orders, currency conversion, weighted-average prices and varying margin rates.
Trading involves risk. EAs do not guarantee profits. Hypothetical examples only. MetaTrader is a third-party trademark; no affiliation or endorsement is implied.
PK Tech Solutions