FoundationsIntermediate23 min read

Margin lets you open a position. Equity has to carry it.

Separate required margin, account equity and market exposure. Work through hypothetical losses, margin changes and competing robots without confusing available leverage with resilience.

A small brass key beside a heavy blue door standing partly open
Conceptual photograph: opening the door and carrying what lies beyond it are different questions.

The green number on the account screen

An automated strategy finds a valid entry. Its rules agree, the order passes the platform checks, and the available-margin field remains positive. It is easy to interpret those three events as confirmation that the position is affordable. They establish something narrower: under the current account rules and observations, the request was admissible. They do not measure whether the next loss would be acceptable, whether another robot will demand collateral, or whether the account can remain open through an interruption.

Consider a hypothetical research account, not a recommendation or a description of a TradeAndRoll robot. It starts with USD 10,000 and can reserve USD 2,000 to support USD 100,000 of exposure. A researcher sees USD 8,000 left and concludes that most of the account is unused. But the market responds to the exposure. A one-percent adverse move on a linear USD-valued position would produce approximately USD 1,000 of loss before costs. That is ten percent of the starting equity, despite the apparently comfortable collateral display.

The misunderstanding comes from asking one number to answer three questions. Can the account open the position? How strongly does its value respond to price changes? How much adverse movement can the intended research or operating process withstand? Margin, exposure and equity answer different parts of that conversation. Treating them as synonyms can make a portfolio look well supplied with capital precisely when its market sensitivity is already large.

This article develops a small accounting model that you can reproduce on paper. Its quantities and margin rules are invented and explicitly fixed for the exercise. Actual account rules vary by broker, legal entity, instrument, account classification and time. The purpose is to learn what to inspect in a robot’s proposed execution environment, not to choose personal leverage or declare a particular position size safe.

Put the quantities in separate columns

Start with cash balance, unrealized profit or loss, and equity. In our simplified account, equity equals cash balance plus the current marked value of open-position profit or loss. Realized trading results and charged fees have already entered the balance. A deposit changes the balance without being trading profit. A position can lose value before it closes, so a balance-only report can conceal a deteriorating account.

The broker then applies its collateral rules to calculate required margin. Our first invented rule reserves two percent of the current USD notional. Available margin is equity minus that requirement. This arithmetic convention is convenient for the example; a real account may distinguish several collateral, cash, credit, conversion and closeout fields. Write down the exact definitions used by the platform instead of translating every field called margin into the same quantity.

OANDA’s platform guide, for example, distinguishes NAV, balance, unrealized P/L and margin used. It is useful as a concrete illustration of separate account fields, rather than a universal rulebook. OANDA account fields.

Next record exposure. A signed exposure expresses direction; gross exposure adds absolute sizes. Neither is an amount already lost. An exposure of USD 100,000 means the position’s economic response is measured on that scale, subject to the contract and conversion method. A required margin of USD 2,000 is collateral under a rule. The account does not stop losing merely because the loss has reached the collateral originally reserved.

Required margin is a condition for participation, not a budget for maximum loss. A stop condition is another object again: it specifies an intended response when a price or account condition occurs. Whether that response can execute at the assumed price depends on market access, liquidity and implementation. Keeping the concepts separate prevents the collateral number from quietly becoming a guarantee that nobody made.

Separate boxes show balance 10000 dollars, unrealized result zero, equity 10000, required margin 2000 and available margin 8000, alongside exposure 100000
Invented opening snapshot. Exposure measures market scale; the other columns describe account accounting and collateral.

Follow one position through an adverse move

For transparent arithmetic, assume a linear position whose USD exposure is held at the reference value of USD 100,000 throughout the first calculation. Ignore financing, transaction charges and changing currency conversion. These simplifications deliberately isolate the distinction between margin and loss; they would be inadequate as a complete Forex execution simulation. Required margin is fixed at USD 2,000 for this first table, even though we later relax that assumption.

At entry, balance and equity are USD 10,000. After a one-percent adverse move, unrealized P/L is minus USD 1,000 and equity is USD 9,000. Available margin is USD 7,000. After a three-percent adverse move, equity is USD 7,000 and available margin is USD 5,000. The collateral field remains positive at both observations. The owner has nevertheless experienced a thirty-percent loss of starting equity in the second observation.

Now compare a second account with the same USD 10,000 equity but only USD 25,000 of the same hypothetical exposure. Under the two-percent collateral rule, it reserves USD 500. The same three-percent adverse market move loses USD 750 and leaves equity at USD 9,250. Both accounts were admissible at entry. Their losses differ because the exposure differs, not because one of the screens was displaying a positive number more confidently.

The comparison also exposes an awkward percentage. The first loss of USD 3,000 is 150 percent of its USD 2,000 initial margin, but thirty percent of initial equity. The second loss is also 150 percent of its USD 500 margin, yet only 7.5 percent of equity. A return measured against collateral can therefore remain unchanged while the experience of the account owner changes dramatically. Always name the denominator.

There is no need to infer a probability from this exercise. We have specified a move and calculated its accounting consequences. We have not estimated how likely that move is, how long it takes, or whether a particular robot would still hold the position. A useful scenario remains useful without pretending to be a forecast. It becomes misleading when a hypothetical price path is presented as the worst possible future.

A closeout threshold is not a protective exit price

Add an invented account rule: a closeout process begins when equity is at or below half of required margin. With fixed required margin of USD 2,000, that threshold is USD 1,000. This is a pedagogical assumption, not a statement that all retail accounts use the same threshold or sequence. Even when a familiar fraction appears in a broker document, the measurement basis, available prices and treatment of positions still matter.

Under our smooth, frictionless calculation, the USD 100,000 position would lose USD 9,000 after a nine-percent adverse move. Equity would then reach USD 1,000. The calculation identifies where an account condition is crossed in the assumed path. It does not show that the position can close exactly there. If the next executable observation arrives after a gap, the realizable result can be worse than the threshold-based mark.

Suppose the previous observable equity was USD 1,200 and the next executable state corresponds to USD 700. The trigger does not create an intermediate transaction at USD 1,000. A system that inserts such a fill has manufactured liquidity. Equally, a historical candle that contains both states does not tell us exactly when the platform observed the condition. A precise-looking account simulator can still be inventing the event that dominates its final loss.

The order in which positions are reduced matters too. Closing a losing leg can release margin but remove an offsetting exposure. Closing the largest position can change currency sensitivity more than closing the oldest one. Account-specific closeout rules therefore belong in the execution assumptions, alongside spread, fees and order handling. The trigger, the selected position and the realized execution are three separate events.

OANDA’s published margin page describes its own tiered requirements and closeout process. Consult the document for the entity actually providing an account; do not transplant its percentages into another environment. OANDA margin calculation. For a research comparison, it is often clearer to label unmodeled liquidation behavior as a limitation than to implement an appealing but unsupported generic rule.

Hypothetical equity points descend from 10000 to 9000 to 7000 while required margin stays at 2000; a separate closeout threshold is marked at 1000
Positive available margin can coexist with a substantial equity loss. A threshold is an account condition, not a guaranteed fill.

The rule can tighten without a new trade

So far required margin stayed fixed. Now imagine the invented requirement increases from two percent to five percent while USD 100,000 of exposure remains open. Required margin rises from USD 2,000 to USD 5,000. If equity is still USD 10,000, available margin falls from USD 8,000 to USD 5,000. No trading loss occurred in this step. The account’s capacity to add positions changed because the collateral rule changed.

Combine that change with the earlier three-percent adverse move. Equity is now USD 7,000 and the new required margin is USD 5,000, leaving USD 2,000 available. This is a different state from a USD 7,000 account with USD 2,000 required. The same market P/L can therefore imply a different ability to continue a multi-robot schedule. A backtest that tracks only profit will miss this constraint even if its arithmetic P/L is correct.

Tiered requirements create another discontinuity. In a hypothetical schedule, the first USD 100,000 reserves two percent and the next USD 50,000 reserves five percent. Total required margin for USD 150,000 is USD 4,500: USD 2,000 plus USD 2,500. Applying the lowest rate to everything would produce USD 3,000 and understate the requirement by USD 1,500. Applying the highest rate to everything would produce USD 7,500 and describe a different contract.

Thresholds may operate on net exposure, gross exposure, product groups or some other specified basis. Conversion rates can also change the collateral value of an otherwise unchanged foreign-currency position. Before simulating tiers, identify what quantity is being compared with each threshold and when that quantity is measured. A correct tier formula applied to the wrong exposure basis is still a wrong account model.

A margin scenario can be a rule shock as well as a price shock. That suggests a useful research grid: hold prices fixed while changing requirements, hold requirements fixed while changing prices, then combine the changes. The separate cases explain the mechanism. The combined case reveals whether two individually manageable disturbances interact badly. None requires claiming that a particular future policy change will occur.

Several robots share one constraint

A package containing several robots does not automatically create several independent collateral accounts. Suppose three hypothetical robots request USD 40,000 each against the same USD 10,000 equity. Under the flat two-percent requirement, each request reserves USD 800 and the combined requirement is USD 2,400. Looking at each robot separately makes the reserve appear small. The account must nevertheless carry their combined USD 120,000 gross exposure.

If all three suffer a two-percent adverse move at the same time, their simplified combined loss is USD 2,400, or twenty-four percent of starting equity. If only one suffers that move while the others are unchanged, the loss is USD 800. The collateral calculation is identical at entry in both scenarios. Dependence between outcomes enters the loss path, not the opening margin label. This is why a diversification claim cannot be established by counting robots.

There is also a scheduling problem. At 09:00, robot A opens a position. At 09:01, robot B requests one. At 09:02, robot C does the same. If each makes its decision using a cached opening snapshot, all may believe the same free capacity remains available. A shared admission process has to evaluate the account after previous accepted commitments. Otherwise the research result can include simultaneous positions that the actual account would have rejected.

Rejection is not merely a missing row. Skipping one entry can alter subsequent exits, position limits and future signals. If a strategy checks whether it is already holding a position, an omitted fill changes its state. A portfolio simulation should therefore distinguish desired trades from admitted and executed trades. Simply deleting some losing rows after an unconstrained backtest does not reproduce a constrained account.

The research question becomes concrete: under a stated chronological admission policy, which candidate entries are accepted, rejected or delayed? Use an explicit priority rule for simultaneous requests. Order by a predetermined identifier, timestamp or allocation rule, not by the outcome that looks best afterward. The policy is part of the strategy portfolio being evaluated and should be visible in the report.

Three robots each request 40000 dollars of exposure and 800 dollars of margin from a single 10000 dollar account; the totals are 120000 exposure and 2400 margin
All quantities are hypothetical. Separate strategy files do not create separate equity or eliminate simultaneous demands on one account.

Offsetting positions do not erase every obligation

Imagine one robot holds a long EUR/USD position and another holds an equal short position. Their simplified directional price sensitivity may offset. Whether the platform keeps two positions, nets them into one, releases collateral, charges financing separately or applies specific hedged-margin rules depends on the account contract. A research ledger should not assume that economic offset and operational netting are the same procedure.

Even where market exposure nets to approximately zero, the histories of the two decisions can matter. One robot may close first, leaving the other direction exposed. A platform can reject the second request or transform it into a reduction of the first. Fees and financing can survive an offset. A copied portfolio return series that ignores these events cannot answer whether the combined instructions were executable in the intended environment.

Consider an invented pair of opposing USD 50,000 exposures. Gross exposure is USD 100,000 and net signed exposure is zero. Under one hypothetical gross-based rule, required margin is USD 2,000. Under a different net-based rule it could be zero for this exact offset, although other minimums might apply. Those are two separate account models. Choosing the more favorable model after seeing the outcome would turn a contractual assumption into another hidden optimization.

Cross-pair offsets deserve even more care. Long EUR/USD and short GBP/USD share a dollar component but retain relative euro-versus-pound exposure. Their nominal dollar amounts can look similar while their response to a particular move differs. Correlation is also an empirical property of a sample, not a contractual guarantee of offset. If a stress episode changes that relationship, a low net dollar figure can coexist with significant loss.

For a first investigation, maintain both a position inventory and an exposure decomposition. The inventory preserves the instructions and contracts. The decomposition summarizes economic sensitivities under explicit conversion assumptions. Keeping both prevents a convenient net number from deleting the positions whose sequencing and costs determine what the account actually experiences.

Measure the path at the resolution that matters

End-of-day equity can be sufficient for one reporting purpose and insufficient for an intraday collateral constraint. Suppose a hypothetical account starts a day at USD 10,000, falls to USD 4,000 at midday, and closes at USD 10,200. A daily series reports a positive return. If the margin requirement was USD 9,000 and the invented closeout threshold was half of that amount, the midday path would cross USD 4,500 before the recovery.

The issue is not that daily data are bad. They answer a daily observation question. They cannot establish that an account survived every unobserved intraday state. If the account would have been liquidated at midday, the afternoon recovery of the original unchanged position is unavailable to that account. The resulting portfolio path is path dependent: passing through a constraint changes later holdings and hence later results.

A minute-close series narrows the blind spot but does not abolish it. Within a minute, quotes can move beyond both the previous and next close. Transaction prices, executable bid and ask, platform valuation marks and broker closeout calculations may differ. The report should state the observation resolution and the price used for marking, without presenting the chosen frequency as a universal guarantee.

Survival between observations is an assumption unless the relevant events are observed. A useful sensitivity exercise compares increasingly demanding paths consistent with the available data. For an OHLC bar, a high-low sequence may remain ambiguous; do not assign the favorable ordering silently. If the available records cannot resolve a constraint crossing, flag the episode instead of filling the gap with a confident-looking value.

This perspective also changes how to read a robot’s historical drawdown. A reported maximum drawdown is tied to the valuation schedule, account model and sample. It cannot simply be converted into a margin requirement by dividing capital by that percentage. The drawdown may exclude open-position losses, ignore financing or describe a portfolio without the intended account constraints.

Deposits and withdrawals move the boundary

An external cash flow can change account capacity without revealing anything new about a trading rule. Begin again with equity of USD 10,000 and required margin of USD 2,000. A withdrawal of USD 3,000 leaves USD 7,000 equity and USD 5,000 available under our simplified model. No trade has lost money. Yet the same future adverse move now consumes a larger fraction of remaining capital.

Suppose a USD 1,000 unrealized loss then occurs. Equity falls to USD 6,000. Relative to the post-withdrawal USD 7,000, the trading loss is about 14.29 percent. Relative to the original USD 10,000, it is ten percent. Neither percentage should describe the USD 3,000 withdrawal as a market loss. Capital movements and trading performance require separate accounting, even though both affect the ability to support an open position.

Deposits create the opposite reporting temptation. An account can show a higher ending balance after additional contributions while the strategy has lost money. A collateral rescue can keep the positions open, but the result then depends on the availability and timing of outside funds. A simulation that assumes unlimited replenishment is testing a different capital arrangement from one with a fixed starting account.

For a reproducible scenario, list every external cash flow with its timing and whether it is known before the relevant account check. A deposit that arrives after a closeout condition cannot retroactively preserve the previous holdings. Likewise, a planned withdrawal may be unavailable because the account rules restrict removal of collateral. These are execution and funding constraints rather than optional presentation details.

It can help to keep two views side by side: a performance series adjusted for external flows and the actual equity path used for collateral checks. The first helps assess trading returns. The second records the resources that were present. They should reconcile through a documented identity, but they serve different questions and need not have the same peaks or percentage drawdowns.

Return on margin can reward the wrong comparison

Suppose two hypothetical account arrangements hold exactly the same USD 100,000 exposure and realize the same USD 1,000 profit. Arrangement A requires USD 2,000 margin; arrangement B requires USD 5,000. Profit divided by margin is fifty percent for A and twenty percent for B. Nothing about the market trade improved. Only the denominator imposed by the collateral arrangement changed.

If both arrangements started with USD 10,000 equity and had no external cash flows, the simple account return is ten percent in both. The smaller requirement can provide additional flexibility, but that flexibility is not automatically an additional return. Using it to add more exposure changes the economic experiment and introduces a new loss path. Comparing the resulting profits without acknowledging the different exposures mixes contract design with strategy behavior.

The denominator also changes over time. Should profit be divided by opening margin, maximum margin, average margin or margin at the moment of closing? Each choice can produce a different number for a strategy that changes size. A very brief peak may dominate maximum margin but barely affect a time average. Neither convention is universally correct; a report must explain the question and preserve the underlying time series.

Compare like resources with like resources. If the question is what a fixed account experienced, use that account’s equity and cash-flow convention. If the question is collateral efficiency under a specified contract, report the margin measure as a separate operational statistic. If the question is market sensitivity, include exposure and stress response. A single impressive ratio cannot replace all three.

This is especially relevant when evaluating several supplied robots. One might trade rarely but reserve substantial collateral while waiting. Another might produce frequent small positions whose combined overlap raises the peak requirement. A per-trade margin ratio can conceal that difference. The portfolio schedule, not merely the isolated trade average, determines the largest simultaneous demand on the account.

Build a small stress worksheet before a large simulation

A useful first worksheet can contain four states. State A is the opening account: USD 10,000 equity, USD 100,000 fixed reference exposure, two-percent margin, USD 8,000 available. State B adds a three-percent adverse move: USD 7,000 equity, USD 2,000 margin, USD 5,000 available. State C keeps opening prices but increases margin to five percent: USD 10,000 equity, USD 5,000 margin, USD 5,000 available. State D combines both: USD 7,000 equity, USD 5,000 margin, USD 2,000 available.

The worksheet is deliberately small enough to audit without software. Check the units first. Equity and margin are money in the account currency; the adverse move is a fraction of a stated exposure. Then check chronology: the rule change occurs before or after a new admission decision, and the price mark belongs to a stated instant. Finally check which quantities remain fixed. A constant reference exposure is not the same as a fixed number of foreign-currency units.

Four hypothetical scenarios compare opening conditions, price loss alone, margin increase alone and both changes, showing available margin of 8000, 5000, 5000 and 2000 dollars
The grid separates price risk from collateral-rule risk before examining their interaction. It does not assign probabilities.

Next add one complication at a time: an external withdrawal, a second robot, a tier boundary, an unobserved gap, or a changing conversion rate. Record the expected direction of each effect before calculating it. If the result contradicts that expectation, trace the accounting rather than editing the assumption until the picture looks familiar. A small contradiction often identifies a more important modeling problem than another annual summary statistic.

A scenario worksheet should reveal assumptions, not certify a safe leverage number. Its output is a map of sensitivities and missing information. To estimate probabilities, you would need a defensible model of joint price changes, execution, funding and account rules, together with uncertainty about that model. A handful of historical worst days cannot establish every future way the account might become constrained.

Fixed currency units still change their dollar value

Replace the fixed reference exposure with a more concrete invented Forex position: a purchase of 100,000 EUR at EUR/USD 1.1000 in a USD account. The initial dollar notional is USD 110,000. With our hypothetical two-percent rule applied to current dollar notional, initial required margin is USD 2,200. Starting equity is still USD 10,000, so available margin begins at USD 7,800. The currency units stay fixed; the account-currency value does not.

If the valuation rate rises to 1.1200, the simplified long-position profit is 100,000 times 0.0200, or USD 2,000. Equity becomes USD 12,000. Current dollar notional becomes USD 112,000 and required margin USD 2,240. Available margin is therefore USD 9,760. The favorable market move improves equity but also raises the dollar value used in this particular collateral rule. Treating margin as permanently fixed would miss USD 40 of that change.

If instead the valuation rate falls to 1.0800, the position loses USD 2,000 and equity becomes USD 8,000. Current dollar notional is USD 108,000, required margin USD 2,160 and available margin USD 5,840. The decline in collateral requirement slightly offsets the decline in equity, but does not remotely cancel it. A report that only notices the lower requirement could describe improving capacity while the account has actually lost a fifth of its starting equity.

These are alternative scenarios from the same opening state, not successive trades. They still omit spread, financing and different conversion or valuation conventions. If the broker applies its requirement to another basis, the calculation must change. The example’s purpose is to show exactly where the assumption belongs and how to reconcile the quantities, rather than to claim that all platforms calculate this position identically.

Write units next to every input. The rate is dollars per euro; the position is euros; multiplying them gives dollars. Subtracting entry and current rates, then multiplying by the signed euro quantity, gives the simplified dollar P/L. A short position reverses that P/L sign without making gross notional negative. Checking these dimensions makes many spreadsheet errors visible before they contaminate an annual portfolio report.

The exercise also clarifies why an instruction such as “use the same size for every robot” needs a definition. Equal base-currency units, equal dollar notional and equal margin usage are three different comparisons. Select the comparison that answers the research question, retain the others as diagnostics, and avoid changing the definition after seeing which produces the most attractive curve.

Ask better questions of the files you receive

When inspecting a robot package, begin by locating the unit of position size, the account currency assumption, the treatment of simultaneous positions and the valuation schedule. Read those definitions before interpreting a profit curve. If they are absent, list them as unresolved inputs. Do not silently fill them with the most generous settings available on a demo platform.

An AI assistant can help build a read-only accounting checklist from documented rules. A useful request is to identify where notional, currency conversion, fees, open-position valuation and admission constraints enter the calculation, then explain which inputs are missing. Ask it to reproduce the four worksheet states with explicit intermediate quantities. A correct explanation of those states is a bounded test of arithmetic, not proof that generated execution code is ready for an account.

Keep the output inspectable. Each number should point to a rule, an input and a timestamp or scenario label. If the assistant changes a fixed notional into a fixed lot size, or treats an external deposit as profit, the discrepancy should be visible immediately. This is also why a spreadsheet with a dozen clear rows can be more useful at the start than a dashboard containing many unexplained ratios.

The related guides on position-size sensitivity, gross and net portfolio exposure and withdrawals and recovery develop the components separately. Bring them together only after their conventions agree. Shared currency labels are not enough if one calculation marks open positions and another waits for closes.

The TradeAndRoll demo offers ten Forex systems with rules, source code and market CSVs for investigation. Use those materials to practise asking what a proposed portfolio requires from an account before deciding how to adapt or test its execution. The useful outcome is a clearer model of the decisions and constraints you control: what is held, how it is valued, which requests are admitted, and what happens when the original assumptions no longer apply.

Back to the Blog