Back to Case Studies
Autonomous Systems · Live Capital

Trading Systems Engineering

Designing deterministic, capital-aware execution systems for live futures markets. This isn't about "building a trading bot" — it's about engineering a capital allocation system that must survive real execution conditions.

Trading Systems - Equity Curve Performance

10k+ Lines of Code

Complex state management in MQL5/Python handling tick-by-tick data.

Risk Engine

Automated position sizing and drawdown protection mechanisms.

Live Execution

Real-world latency management and order execution logic.

Since 2021, I've designed and iterated automated futures systems under real capital and prop-firm rules. The focus has never been maximising backtest equity curves.

Prop firm trailing drawdown
Real execution latency
Slippage & spread
Volatility regime shifts
Parameter instability
Losing clusters
Backtest inflation
Strategy decay
1Robustness first.
2Risk containment second.
3Performance third.

System Architecture Philosophy

The system is intentionally deterministic and correctness-first.

Single-threaded execution logic
Explicit state transitions
No hidden behaviour

In high-risk environments, unpredictability is unacceptable. Every trade decision must be reproducible, auditable, and explainable.

This architecture was refined after diagnosing real execution bugs — bid/ask mismatches, contract sizing errors, invalid price logic — not hypothetical ones. The system exists because those failures happened.

01

Risk Engine

Primary Layer

Risk is not an add-on. It is the system.

Everything else is secondary.

1

Equity-Based Position Sizing

Position size recalculates per trade based on current equity, not starting balance.

  • ›True % risk enforcement
  • ›Automatic volatility adjustment via stop distance
  • ›Tick value, spread, contract specification accounted for
If equity drops → exposure contracts.
If equity rises → size scales.
This is controlled, not optimistic compounding.
2

Linear vs Compound Growth Modes

The engine supports two scaling regimes:

Linear Mode

  • Fixed risk based on initial capital
  • Used for funded or rule-constrained accounts
  • Stable equity profile

Compound Mode

  • True equity-based scaling
  • Exponential growth if edge holds
  • Used selectively on personal capital

Mode selection is per strategy and per account type. This is capital allocation control — not curve chasing.

Complete equity curve showing strategy performance across all test sets
Equity curve — Complete test set results
3

Multi-Layer Drawdown Enforcement

The system enforces drawdown across multiple dimensions:

Absolute equity floorBalance-based limitsEquity-based limitsDaily loss capTrailing drawdown modelling

Trailing drawdown logic internally tracks equity high-water mark and remaining buffer — preventing accidental rule breaches in challenge or funded environments.

4

Dynamic Risk Reduction Under Stress

If total account drawdown exceeds a configurable threshold, the system can:

  • ›Reduce risk per trade
  • ›Switch to defensive sizing mode
  • ›Disable compounding
  • ›Pause new entries entirely
This logic exists specifically because losing clusters are inevitable — and survivability is the priority.
5

Hard Kill Switch

Independent of all logic:

If equity breaches absolute minimum threshold:

→ All positions flattened

→ Trading disabled

→ Manual reset required

Non-negotiable protection.

02

Strategy & State Logic

The system does not optimise random parameter sets.

It begins with a structural hypothesis.

✦A defined market behaviour thesis
✦Explicit invalidation conditions
✦Clear risk-reward constraints
✦Validation, not discovery

Multi-Timeframe Structural Alignment

Bias construction across higher, mid, and lower timeframe structure. Trades only occur when structural alignment confirms thesis.

This reduces exposure to counter-trend noise and regime mismatch.

Strategy tester configuration showing parameter settings and execution rules
Strategy tester — Parameter configuration & execution settings

Liquidity Event Modelling

Entries are structured around prior highs/lows, liquidity sweeps, and structural shift confirmation.

The system does not enter at obvious liquidity.
It waits for the sweep and confirmation.

Setup Validation Gates

A trade must pass every gate before execution:

Minimum R:R requirement
Spread threshold
Structural validity
Risk constraint compliance

If it fails one gate → it is not traded.

03

Execution Layer

Execution is not assumed to be perfect.

It is engineered around friction.

Stop & Target Placement

Stops are placed at structural invalidation — not arbitrary pip values. Targets are placed at logical liquidity zones. This ensures risk reflects actual thesis invalidation.

Structural Trailing

Trailing is not fixed-distance. Stops trail behind new structural pivots once profit exceeds a defined threshold. This allows trades to expand without premature stop-outs.

Break-Even Automation

Break-even activation is calibrated — not emotional. Only triggered once structural extension confirms directional strength.

MQL5 code showing SL/TP placement logic - GetClosestHighAbovePrice and GetClosestLowBelowPrice functions
MQL5 — SL/TP placement using structural high/low detection

Trade Logging & Data Capture

Each trade logs metadata for iterative refinement:

SessionSetup typeR multipleSpreadExecution outcome

Processing 150,000+ optimisation results weekly is part of the broader development process. This creates an automated journal without manual input.

04

Quantitative Validation

This is where most retail systems fail.

Walk-Forward Testing

In-sample optimisation followed by out-of-sample validation. Ratio splits commonly 1:3 or 1:2 depending on performance stability.

Parameter sets must survive forward data before deployment.

Trend engine equity curve showing walk-forward validation results
Equity curve — Trend engine walk-forward results

Parameter Stability Analysis

If shifting a parameter 10% destroys performance → rejected. Robust systems show clustered performance across neighbouring parameter sets.

I actively favour stable performance clusters over peak results.
Strategy Tester optimizer inputs showing parameter ranges for lot sizing, risk management, and entry configuration
Optimizer inputs — Parameter ranges for stability testing across account settings, lot sizing, and entry logic

Sample Size Discipline

No strategy is considered structurally valid without significant forward sample size, multi-month validation, and equity curve consistency. Short bursts of performance are ignored.

Equity vs Profit Curve Correlation

Monitoring includes smooth equity behaviour, absence of single-trade dependency, and limited deviation between equity and balance curves.

A fragile spike-driven system is discarded — regardless of total return.

Strategy tester graph showing correlated balance (blue) and equity (green) curves with deposit load over time
Balance (blue) vs Equity (green) — Tight correlation indicates low floating drawdown exposure

Engineering Reality

Backtests overstate performance.

Execution degrades edge.

Markets change.

A system that performs for 24 months and collapses in year 3 is not robust. Durability outweighs Sharpe.

This mindset aligns far more with institutional quant validation than retail optimisation.

Summary

This trading system is not a strategy script.
It is a capital-preservation framework with a thesis-driven execution model.

✓Deterministic architecture
✓Real capital constraints
✓Large-scale optimisation & filtering workflows
✓Risk-first engineering philosophy

Survive losing clusters.

Scale when edge exists.

Disable when it doesn't.

Snedker Automations Assistant