The diagram you sent is good as an aspiration, but for the current state of the project, the realistic version is this:
Market Data
|
v
Data Validation / Normalization
|
v
Feature Pipeline
|
v
Strategy Engine
|
v
Risk Engine
|
v
Execution Adapter
|
v
Trade Log / Metrics / Feedback
Because currently we have no strong reason to centralize the system around:
- a full ML layer
- a core LLM layer
What has already proven important is:
- valid data
- consistent features
- fair backtesting
- fair walk-forward
- strict risk control
- safe execution
Responsibilities:
- load CSV / broker feed
- standardize schema
- validate timestamp, duplicates, gaps, spread sanity
- isolate symbol and timeframe specific quirks
Should not contain:
- signal logic
- risk logic
- order placement
Responsibilities:
- EMA, ATR, RSI, spread features
- candle structure
- volatility and session features
- optional regime labels
Should not contain:
- SL/TP rules
- broker logic
Responsibilities:
- consume clean features
- output setup / signal candidate
- no broker side effects
- no direct file IO if possible
Minimal output:
- side
- entry condition
- stop reference
- target reference
- reason tags
Responsibilities:
- position sizing
- max concurrent exposure
- spread filter
- drawdown monitor
- daily loss guard
- kill switch
This must be a hard gate before execution.
Responsibilities:
- paper trade or broker order submit
- idempotent order actions
- retry rules
- fill/update/cancel handling
- persistent state and journal for runtime decisions
Responsibilities:
- trade ledger
- equity curve
- per-strategy metrics
- out-of-sample reports
- error logs and execution events
The initial reusable foundation is now in place:
data/loader.pyfor basic OHLCV data loading + validationfeatures/indicators.pyfor EMA, ATR, RSI, session featuresstrategies/base.pyfor the strategy interfacestrategies/tf001.pyfor proof-of-concept strategy implementationstrategies/sr_sd_v35.pyfor second research candidate migrationstrategies/sr_sd_v35_short.pyfor refined short mirrorstrategies/sr_ema_v41.pyfor bias-prone static S/R + EMA comparisonbacktesting/engine.pyfor minimal unified backtest enginerisk/manager.pyfor sizing + drawdown / loss guardsexecution/paper.pyfor paper-trade state/journal flowexecution/portfolio.pyfor candidate portfolio signal collectiondata/mt5.pyfor MT5 data bridge from terminal to strategy enginereporting/metrics.pyfor summary metricsreporting/ledger.pyfor trade ledger exportrun_backtest.pyas single entry point for backtestingrun_paper_trade.pyfor CSV-based candidate portfolio paper-trade runnerrun_paper_trade_mt5.pyfor MT5-connected paper-trade runnerrun_paper_trade_mt5_loop.pyfor MT5-connected periodic runtime
This means the project is no longer just a pile of experimental scripts. It now has a reusable core.
ML comes in after the baseline strategy engine is clean. Realistic roles:
- regime classifier
- probability calibration
- trade quality scoring
- feature importance study
Not a total replacement of all logic from scratch.
LLM is suitable later for:
- operator summary
- anomaly explanation
- strategy comparison notes
- natural language reporting
- maybe regime commentary
LLM must not be the primary source of entry/exit without a very strict validation framework.
Research-first layered
- research scripts still exist
- common logic is being extracted
- no fake abstraction
Modular layered core
Add reusable modules for:
- loaders
- features
- signals
- backtest
- metrics
Operational architecture
Add:
- a richer risk service/module than the current basic guards
- execution adapter
- persistent trade log connected to paper/live flow
- alerting and kill switch
ML-assisted architecture
Add ML scoring/regime layer on top of the feature pipeline, not directly on top of the broker.
research/experiments/tf001/→ early EMA pullback familyresearch/experiments/sr_sd/→ S/R plus supply-demand experimentsresearch/experiments/sr_ema/→ S/R plus EMA family, includes biased result historyresearch/walkforward/→ fairness check and no-look-ahead validationresearch/cross_asset/→ transferability sanity check
src/xauusd_trading/data/src/xauusd_trading/features/src/xauusd_trading/strategies/src/xauusd_trading/risk/src/xauusd_trading/execution/src/xauusd_trading/reporting/src/xauusd_trading/backtesting/src/xauusd_trading/models/
- Strategy first, glamour later
- No look-ahead, ever
- Research and production paths must be separated
- Risk layer is mandatory, not optional
- Execution must be safer than the strategy is clever
- ML and LLM must earn their place with evidence