Development of a maximum drawdown control system

Drawdown eats profits when decisions are made blindly. We develop turnkey maximum drawdown control systems: we set thresholds, auto-stop, and alerts so that risk is visible before it becomes a loss. Limits trigger automatically, and decisions are made on live data.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Where maximum drawdown control breaks

Positions are open across several instruments, the portfolio drawdown risk limit is set, and then the market moves in a single move — within minutes, without intermediate rebounds.

Yet protection triggers not when it should: the oracle price arrives late, the risk module calculates drawdown from the last saved state snapshot, and the forced-close order queues up and executes beyond the limit.

The result: not one position is closed but the entire basket, and not by our decision, but by someone else's.

The root cause is that maximum drawdown control is kept outside the execution loop: a separate monitor polls state at intervals, the limit is checked before a trade but not after, and there is no atomicity between calculation and execution.

When a sharp market move is added, all three assumptions break at once: the signal lags, the limit is calculated from stale data, and the trading system has no "pause" state it can safely enter.

On Ethereum, this is compounded by transaction ordering and fees changing faster than the calculation snapshot can update.

Another silent failure point is rounding and slippage: the limit is not formally breached, but actual portfolio drawdown is already past the threshold because the check has no execution buffer built in.

Worst of all, such a failure does not reproduce in a calm market and is not visible in ordinary trading logs.

We break down how this is closed: the drawdown limit becomes an invariant checked before and after every position change, with a dedicated emergency mode and a pre-defined exit procedure.

What continuous risk control delivers: the effect in metrics

We calculate drawdown not at the end of a trading day but on every update of the trade and quote stream: realized P&L is added to unrealized, order book depth and expected slippage are taken into account.

That is why risk reaction time shrinks from minutes to seconds — the threshold is checked before a position moves further, not after the candle closes.

The share of false limit triggers falls because the threshold is calculated from a full position valuation, not from the last price.

In a thin market we add window smoothing and a confirmation requirement: a single quote outlier no longer stops the strategy, while a genuine limit breach does.

An entire class of failures disappears — the gap between calculation and execution.

Previously, drawdown was breached during the time it took the on-duty operator to notice the deviation and manually place an order; now the rule triggers in the same cycle where the update arrived, and no position remains unclosed at the moment of breach.

Risk control automation removes routine reconciliations from the on-duty shift: the rules themselves bring the position to the limit, write an event to the log, and send a notification.

Humans remain for anomalies and incident investigations — the share of paths covered by checks grows rather than relying on a specific operator's memory.

Maximum drawdown control formats: thresholds and auto-stop

The drawdown limit is not a single number but a set of thresholds tied to a measurement window. Soft thresholds provide reaction buffer; hard limits cover the scenario where the reaction was too late.

Leaving only the upper threshold in place triggers either too late or on ordinary market fluctuation.

The options differ in who makes the decision — the operator or the code.

Monitoring and warning leave the choice to a human, while volume limiting and trading auto-stop execute deterministically: the check uses the oracle price at every step, and triggering does not depend on whether someone managed to press a button.

Mode When it fits Limitations
Monitoring Threshold calibration on history, collecting strategy statistics Blocks nothing: losses continue to accumulate
Warning (soft threshold) Early stage, high volatility, flexibility needed Works with operator discipline, easily ignored
Volume limiting Smooth position reduction as the limit approaches More complex to configure, unfavorable partial exits possible
Full stop Hard contour where the cost of error is higher than missed profit Requires manual confirmation to resume, reacts to a brief spike

In practice, modes are set as a combination: monitoring for calibration, a soft threshold as a warning, and a full stop as a hard contour. Thresholds are kept in the strategy configuration — they can be changed without rebuilding the logic.

Implementation stages: from data flow audit to handover

Work proceeds sequentially: first we capture how the risk contour is currently structured, then we design maximum drawdown control rules, and only then do we write code.

This sequence eliminates rework — each subsequent decision relies on a validated data flow diagram, not assumptions about it.

Analysis and design

  1. Risk contour audit. We break down where prices come from, how often they update, where drawdown is currently captured, and which thresholds are set manually.
  2. Data flow diagram. We bring sources, calculation modules, and stopping points into one diagram: it becomes visible where latency occurs and where control loses relevance.
  3. Rule design. We formalize what counts as peak equity, how to calculate drawdown, and what follows a threshold trigger — pause, position reduction, or full stop.

Validation and handover

  • Configuration and stress scenarios. We run sharp crashes, long smooth declines, and liquidity gaps: the rules should not trigger chaotically on every fluctuation.
  • Historical validation. We calculate metrics over past periods — how many times the contour triggered, what share of stops were false, and how deeply the system managed to stay within the specified boundary.
  • System handover. We deliver the threshold regulation, trigger logs, and instructions for changing parameters, and train the team to change them without code edits.

Configurations, limit policies, and regulations at delivery

We deliver not only a working control contour but also a document package according to which the system operates after launch. Without it, maximum drawdown thresholds change "from memory," and protection triggering depends on who is on shift today.

  • Configuration files — drawdown threshold values per strategy and instrument, calculation baseline, and averaging window. A single source of truth instead of code edits.
  • Limit policies — three reaction levels: warning, partial position reduction, full stop. The levels are tied to drawdown depth and speed, not to a single number.
  • Role matrix — who sets thresholds, who confirms a change with a second signature, who can view telemetry read-only. Rights are separated between test and production contours.
  • Data flow diagrams — at which point the metric is captured, at what moment drawdown is calculated, through which channel the signal goes, and who receives it.
  • Trigger response regulation — a step-by-step scenario for the on-duty shift: what to check in the first minutes, who decides on a manual stop, the escalation point, and the response time standard.
  • Threshold change procedure — request, validation of the new value on historical data, rollout to a limited contour, and logging with author and rationale.
  • Audit log — all triggers, manual interventions, and limit edits are recorded. The incident timeline is reconstructed without polling participants.

Case study: how a series of risk failures on a volatile market was eliminated

Starting point: control existed, but reacted later than the market

The risk contour calculated maximum drawdown from a single price from an internal cache that updated once a minute. On sharp moves, this created latency: the threshold triggered later than the market, and manual investigation by the on-duty engineer took up to 15 minutes.

Over a quarter, more than 40 triggers accumulated, and 6 out of 10 were false — the price had time to return while positions had already been closed at market.

What was rebuilt

We assemble the price as a median from several independent sources, and recalculate limits on every block rather than by timer. A source that deviates beyond a set threshold drops out of the median — a single outlier no longer drags the entire portfolio into closure.

Thresholds and source composition are moved to configuration, so the mode changes without code edits; the trigger log and deviations per source are captured in Grafana.

Metrics before and after

The share of false triggers fell from 6 out of 10 to 1 out of 20. Reaction time: previously up to 15 minutes of manual investigation, now an automatic decision in seconds.

Positions are still closed on a real limit breach — the mechanism is not disabled, it simply stopped triggering on noise. The class of failures that no longer reproduces is cascading portfolio closure based on a stale price from a single source.

What to do if limits are configured but trigger late?

Most often, the problem is not in the rules themselves but in the data pipeline: the limit is calculated from a position snapshot that has already gone stale.

If portfolio state reaches the risk engine through periodic polling, an intermediate queue, and delayed aggregation, then by the time of calculation the recorded maximum no longer matches the market.

This is also where the system's late reaction comes from — the threshold is formally set correctly, but entry into it lags.

The first step is to measure latency across the entire chain and break it down into stages: confirmations, state reads, event aggregation, metric recalculation.

The bottleneck in the data is almost always single and local — it is visible from the discrepancy between the event time and the time when the metric updated.

Next, the stream is switched to continuous processing with the event timestamp rather than the processing timestamp. This gives correct recalculation order for catch-up packets and redeliveries: the drawdown peak is neither understated nor inflated by duplicates.

Idempotent writes and deduplication by trade identifier are enough — there is no need to rewrite the entire system.

Only after that does threshold configuration make sense. The threshold is tied to the calculation window and the actual stream latency: an anticipatory level is introduced that limits risk growth, along with a confirming level that triggers on a sustained breach.

Hysteresis and holding time remove chatter, while level-based escalation — from warning to forced position reduction — makes the reaction predictable.

Technical concerns: latency, false triggers, failures

The first thing checked before launch is contour behavior under data latency. The price is taken from several independent sources, divergence between them is calculated, and every tick has a timestamp.

If the stream on one channel disappears or the data is staler than the set threshold, the decision is made from the backup source, and the divergence itself is written to the log.

False triggers are born not from logic but from noise on a short window. That is why the drawdown threshold is calculated from a confirmed value — with an averaging window and a requirement to hold the condition for several consecutive readings.

Each strategy has its own set of thresholds, windows, and acceptable risk, while contour fault tolerance is built so that an executor failure does not leave a position uncontrolled.

What happens if the quote stream disappears for several minutes?

The contour switches to a backup source, and if both are unavailable, it moves the strategy into a protective mode: new entries are blocked, and open positions are maintained using the last confirmed value.

The data gap is recorded with an exact timestamp so that after the stream is restored the decision can be reproduced and reviewed.

How are different thresholds configured for strategies?

The threshold, confirmation window, and partial position reduction rules are described by a separate profile for each strategy.

Profiles are versioned: a threshold change is validated on historical data and only then goes into production, while the previous version remains available for rollback.

Can a false trigger close a position unnecessarily?

First, the contour is launched in monitoring mode — conditions are calculated, decisions are written to the log, and no orders are placed. From it, you can see how many times the threshold would have triggered and on what noise.

Then a confirmation window is selected such that triggers occur on real moves rather than market noise.

What about hardware, network failures, and restarts?

Strategy state and all decisions are stored in the log, and actions are idempotent — a retry after a disconnect will not place a second order.

An executor failure does not disable drawdown control: the contour comes up, reconciles the actual position with the calculated one, and continues from the same place. On-duty coverage and notifications are configured separately, with post-launch incident reviews.

Let's discuss the task: what we need from you and where we start

For the maximum drawdown assessment to be workable rather than theoretical, we need a minimum of source data. Gather what you have on hand: for the first review, a rough description is enough — we will fill in clarifying details as the discussion progresses.

  • Strategy logic and entry/exit rules: how a position is opened and by what event it is closed.
  • List of assets, venues, and segments where trading is conducted — including exchange and withdrawal of funds between contours.
  • Current risk management rules: position limits, stop threshold, who changes it and how.
  • Data sources: historical series of trades and quotes, sample depth, frequency, presence of gaps and breaks.
  • Access for integration: keys to exchange interfaces, network nodes, and external data sources — with environment-based permission separation.
  • Requirements for the contour: where we host the system, whether isolation is needed, which reaction latencies are critical.
  • Acceptance criteria: what system behavior you consider correct during a sharp market move and during a connection loss with the venue.

We will bring this together, verify assumptions about the data, and come back with an assessment and work plan: the order of stages, what we do, what remains on your side, and where the result control points are. Describe the task — we will clarify the rest during the review.