DEEP DIVE

Inside the
architecture.

Seven components. One message bus. Same code runs in backtest and live. Every decision auditable.

SYSTEM OVERVIEW

Architecture at a glance

DATAREGIMESTRATEGYRISKEXECAIBUSLOG
DETECTION SYSTEM

3-Layer Regime Detection

Three detection methods vote in ensemble. Speed, depth, and strategic context combined.

01

Rule-Based Classification

Every bar

ATR percentile ranking detects volatility expansion or contraction. ADX measures trend strength. SMA slope confirms direction. Fast, deterministic, zero look-ahead bias.

ATR(14) percentile over 100 bars
ADX(14) with directional indicators (+DI/-DI)
50-period SMA slope normalized by price
Bollinger Band Width percentile
LIVE INDICATORS
ATR %ile65%
ADX34
SMA Slope0.72
BBW %ile42%
SAMPLING EVERY BAR
02

Hidden Markov Model

Daily

A 3-state Gaussian HMM fitted on rolling 252 days of log returns and Parkinson realized volatility. Provides probabilistic state assignment with transition matrices.

3-state model (trending, volatile, calm)
Parkinson volatility estimator (high-low range)
Baum-Welch parameter estimation
Filtered probabilities for real-time inference
STATE TRANSITIONS
TRENDVOLATILECALMP(transition)
03

Macro Overlay

Weekly

Long-term structural context. 50/200 SMA structure identifies the macro trend. Hurst exponent measures persistence vs mean-reversion character.

Price vs 50/200 SMA structure
Hurst exponent (200-bar R/S analysis)
Structural trend identification
Strategic veto on tactical signals
SMA CROSSOVER
WEEKLY STRUCTURAL ANALYSIS
COMPONENT PIPELINE

7 Components. One system.

Data flows through each component in sequence. Watch it light up.

Data Engine

Streams live market data, constructs candles across timeframes, computes 11 technical indicators, maintains rolling price buffers.

Regime Detector

3-layer hybrid ensemble. Rule-based speed, HMM statistical depth, macro strategic overlay. Votes with confirmation delay.

Strategy Engine

Selects and weights strategies based on detected regime. Session-aware. Only activates strategies when conditions favor them.

Risk Manager

Mandatory gateway. ATR-normalized position sizing, daily/weekly drawdown circuit breakers, max position caps. Non-bypassable.

AI Context Engine

Claude analyzes macro conditions every 5 minutes. Validates regime, assesses trade permission, provides directional bias with reasoning.

Execution Engine

Routes orders to brokers. Order lifecycle FSM tracking. Position reconciliation. Dual accounting (desired vs actual).

Decision Logger

Structured JSON audit trail. Every event, every decision, every reasoning chain. Full accountability.

DATA FLOW PATH
DATA
REGIME
STRATEGY
RISK
AI
EXECUTION
DECISION
COMMUNICATION LAYER

The Message Bus

Every component publishes and subscribes. Zero coupling. Full observability.

Message BusEVENT STREAM
PUB/SUB
Listening...
← Back to Home