How Strategies Are Created, Optimized, and Validated
A clear end-to-end guide to how the Java Strategy Service and Python Research Engine work together, including walk-forward optimization, regime memory, and research-only gating.
1. Strategy Lifecycle
Define Strategy
Create a hardcoded Java strategy or a Generic strategy definition with variables.
Backtest Engine
Strategy Service runs the canonical backtest with CSV candles and MockBroker.
Optimize + Validate
Python WFO selects params on train window, validates on test, then rolls forward.
Strategy Types
Hardcoded Java strategies are production-grade. Generic strategies are stored as definitions with variables (like macd_line) for fast experimentation.
Optimization Modes
Server optimizer runs grid search in Java. Local optimizer uses Ray+Optuna but still calls the Java backtest engine for each trial.
Regime Memory
Each 1-minute bar is converted into a 20-dimensional regime vector and stored in Qdrant. Forward labels are added later to avoid look-ahead bias.
market_regimes_1m with deterministic IDs.Research-Only Gate
For each trade in backtest, the system checks similar past regimes. If expected outcomes are weak, the trade is blocked and the impact is reported.
gate_report per window.2. Outputs You Can Trust
Research Report
JSON report with window metrics, stability score, and gate impact.
Regime Memory
Qdrant vectors with forward labels for future gating and analysis.
Behavior Vectors
Strategy fingerprints to deduplicate and diversify portfolios.