From our research notebook

Risk Controls That Belong Inside Every EA

Our risk-management work took us beyond stop-loss settings to position sizing, shared exposure, daily limits and the handling of failed requests.

Many development conversations started with where to enter a trade. Our risk-management work kept bringing us back to another question: how much exposure should the account accept, and who can stop the next request?

We work backward from the loss

We start sizing with the permitted loss and the protective distance. Tick value, contract size and account currency connect that distance to money; broker volume steps and margin then limit the usable size. A fixed lot does not carry a fixed risk across every symbol or stop distance.

We look at the account as well as the trade

Several individually acceptable positions can depend on the same market move. We therefore consider combined exposure, pending orders and the capacity already being used. Daily limits also need a defined clock and a clear mandate: blocking new entries is a different action from closing positions that already exist.

We follow a request through to its outcome

A requested stop adjustment may fail. A terminal may restart with positions still open. Those situations led us to think about confirmation, recovery and understandable messages as part of risk control. The implementation needs to say what is blocked, what remains supervised and how a restricted state is reset.

Explore the technical detailOpen the full method, worked examples and implementation questions. We have kept this material here so you can follow the reasoning as far as you need.

Entry logic decides when a system would like to trade. Risk logic decides whether it is allowed to trade, how much it may expose, and when that permission ends. Treating these as one mixed block makes both harder to test.

Our archive contains twenty-nine records centred on risk and trade management. The recurring requests include percentage-based sizing, stop and break-even rules, equity and drawdown protection, trailing logic, session limits, and separate management tools. Together they point to a layered design rather than one universal stop setting.

Engineering note · ENG-02

How risk control works

Protection is applied in order: position size, trade protection, strategy exposure, session limits, and finally account-level safety.

  1. 01
    PositionCalculate volume from the intended loss distance and verified symbol properties.
  2. 02
    TradeDefine protective stop, target, break-even, trailing, and invalidation rules.
  3. 03
    StrategyLimit simultaneous trades, direction, symbol concentration, and repeated entries.
  4. 04
    SessionApply daily or weekly loss, trade-count, time, spread, and event limits.
  5. 05
    AccountGive equity, margin, connectivity, and emergency controls final authority.

Size from the loss

A fixed lot can represent very different risk when the stop distance, tick value, contract size, quote currency, or account currency changes. Risk-based sizing therefore begins with the amount the account is allowed to lose and works backward through the protective distance and the symbol specification.

The result still needs normalization to broker volume steps, minimum and maximum volume, available margin, and any portfolio cap. If a valid size cannot be calculated, the safer result is no trade with a clear reason—not a silent fallback to an arbitrary lot.

Define the protective path

A stop-loss is one control inside a longer position lifecycle. The EA may also move to break-even, trail behind price or structure, scale out, close on time, or exit when the original setup is invalid. Each action needs a trigger, a new state, and a clear rule for whether it may loosen protection.

Risk rules should also account for failed modifications. A requested stop update is not a completed stop update. The system needs to check the broker response, record the failure, and decide whether to retry, close, or suspend further action.

Control combined exposure

Maximum trades is not the same as maximum risk. Several positions can share the same currency, market direction, or underlying factor. A strategy-level control may limit total open risk, same-direction exposure, risk per symbol, or the number of setups that can be armed at once.

When several EAs share an account, the calculation must define ownership. Magic numbers and comments help identify positions, but portfolio controls may still need to see the whole account. The signal EA should not assume that unused margin belongs only to it.

Set daily authority

Daily and weekly controls are useful because a valid individual trade can still occur inside an unacceptable sequence. Loss limits, profit locks, trade-count limits, time windows, spread filters, and event blocks define when the strategy must stop requesting new exposure.

The reset boundary must be explicit. Broker time, UTC, and the trader’s local day are not always the same. The system should also say whether a daily stop blocks new entries only or closes current positions, and whether manual reopening is allowed.

Make failure controlled

Account protection includes conditions that are not visible in a normal backtest: stale prices, missing history, abnormal spread, rejected orders, invalid stops, low margin, terminal restart, and loss of an external dependency. These states should fail closed whenever continuing would create unknown exposure.

A practical risk system explains its action. The log or dashboard should show which layer blocked trading, the threshold or state that was reached, the reset policy, and whether current positions remain supervised. A safety rule that cannot be understood is difficult to trust and difficult to test.

  • Calculate position size from risk, protective distance, and current symbol properties.
  • Place and verify protective orders; do not treat a request as a confirmed broker result.
  • Limit combined exposure, not only the number of tickets.
  • Define daily and weekly stop authority, timezone, and reset behaviour.
  • Use a final emergency state for unreliable data, margin, execution, or connectivity.

Questions you may have

Is a stop-loss enough for EA risk management?

No. It limits one position under stated assumptions. Sizing, combined exposure, sequence limits, broker execution, and account-level authority remain separate questions.

Should a daily loss limit close open trades?

That depends on the mandate. The rule must explicitly choose between blocking new entries, reducing exposure, or closing positions, and it must define the reset boundary.

Can risk controls guarantee a maximum loss?

No. Gaps, slippage, order rejection, outages, and market conditions can exceed intended limits. Controls reduce and organize risk; they do not remove it.

Turn a risk percentage into rules the EA can actually enforce

Scroll the diagram horizontally or open it at full size.

Turn a risk percentage into rules the EA can actually enforce
Educational design example — values and states are not live performance.

Allowed → observe → Pause at the stated boundary

Illustrative units; use the article’s verified assumptions.

Open full diagram ↗

Turn a risk percentage into rules the EA can actually enforce

Risk-based volume starts with planned account-currency loss, not margin. For a linear instrument: raw volume = loss budget ÷ loss per lot from entry to stop. Then round down to the broker’s volume step and calculate the loss again. OrderCalcProfit can estimate the account-currency result for the stated prices; margin is a separate capacity check.

Two constructed sizing examples
Case Budget and loss per lot Raw → allowed volume Decision after recalculation
USD account $100 budget; $500 loss per lot 0.20 → 0.20 lots Estimated stop loss $100: allowed
EUR account, converted result €75 budget; €820 loss per lot 0.0915 → 0.09 lots Estimated loss €73.80: allowed
Below minimum $3 budget; $500 loss per lot 0.006 → broker minimum 0.01 Estimated loss $5 exceeds budget: reject, do not round up

Define daily loss in one equation. Example: adjusted day P/L = current equity − start-of-day equity − deposits + withdrawals. A −$400 floor blocks new risk once reached. Decide whether the measure also tracks drawdown from the day’s highest equity; it is a different control. Store the baseline, timezone and breached state so a restart cannot reset authority.

A practical priority is: data and symbol validity; emergency/kill state; account daily limit; portfolio and symbol exposure; per-trade loss; margin and broker constraints; then send. A gap can exceed modeled stop loss. A rejected close leaves exposure. A partial fill creates both position and remaining-request states. A disconnect permits no new exposure and requires reconciliation on return.

What to verify

  • Recalculate loss after volume rounding and reject when the minimum lot breaches the budget.
  • Replay deposits, withdrawals, floating loss, new equity highs and restart around the daily boundary.
  • Test gap, rejected close, partial fill and disconnection with the remaining risk shown, not hidden.

Limits of this example

Planned stop loss, stress loss, margin requirement and factor concentration are separate measurements. No single percentage or margin function replaces the others.

Editorial ownership and primary references

Reviewed by POLARIS Research

Evidence scope

This article combines official platform behaviour with recurring, anonymized implementation patterns. Exact trading rules and client material are excluded.

Primary references

These references support platform behaviour or research concepts. They do not validate POLARIS performance and do not guarantee future results.

Explore the next relevant layer

Move between focused research, system engineering and portfolio construction without losing the context of this page.

Contact POLARIS on WhatsApp