Skip to content

06 Live Trading and Deployment Guide

ElMoorish edited this page Sep 12, 2026 · 1 revision

💻 06. Live Trading & Deployment Guide

This guide outlines the production deployment workflow for TriDomainMoE with live MetaTrader 5 order execution and the real-time institutional telemetry dashboard.


1. System Requirements

  • Operating System: Windows 10/11 (required for native MetaTrader 5 IPC bridge) or Linux with Wine / MT5 Gateway.
  • Python: Version 3.11+
  • Hardware: Dedicated GPU (NVIDIA RTX 3060 / 4060 or higher recommended for continual ReCAP cycles).
  • MetaTrader 5: Installed terminal logged into an institutional broker demo or live account with algorithmic trading enabled.

2. Environment Configuration

  1. Clone the repository:

    git clone https://github.com/ElMoorish/TriDomainMoE.git
    cd TriDomainMoE
  2. Create virtual environment and install dependencies:

    python -m venv venv
    .\venv\Scripts\activate
    pip install -e .
  3. Configure environment variables: Copy .env.example to .env and fill in your MetaTrader 5 connection credentials:

    copy .env.example .env

    Edit .env:

    MT5_LOGIN=YOUR_ACCOUNT_LOGIN
    MT5_PASSWORD=YOUR_ACCOUNT_PASSWORD
    MT5_SERVER=YOUR_BROKER_SERVER
    MT5_PATH=C:\Program Files\MetaTrader 5\terminal64.exe
    TRADER_LOG_DIR=logs/

3. Running the Live MT5 Execution Trader

The trader daemon connects to the active MT5 terminal, streams real-time ticks, builds M5 features, evaluates the 4 enhancement defense vectors, and executes orders with hard stop-loss/take-profit brackets.

python scripts/live_mt5_trader.py \
    --symbol BTCUSD.x \
    --timeframe M5 \
    --weights weights/btcusd_tri_domain_v2.pt \
    --risk-pct 0.0020 \
    --enhanced \
    --breakeven-ratchet \
    --interval 5

Key Flags:

  • --risk-pct 0.0020: Allocates $0.20%$ equity risk per trade ($20.00 cash risk on a $10k account base).
  • --enhanced: Activates Vector 1 (Anti-Adverse Order Book Shield) and Vector 3 (Router Shannon Entropy Gating).
  • --breakeven-ratchet: Activates Vector 2 (ratchets Stop-Loss to Breakeven $+ \text{Spread} + 2\text{ pts}$ when unrealized profit reaches $+1.5\sigma$).
  • --interval 5: High-frequency polling frequency in seconds.

4. Launching the Institutional Telemetry Dashboard

The dashboard provides a Bloomberg-style dark terminal interface displaying live streaming quotes, MT5 account solvency, active positions, expert allocation gauges, and daily trade performance.

python scripts/serve_dashboard.py

Open your browser and navigate to:

http://localhost:8888

Dashboard Tabs:

  • Terminal Hub: Live bid/ask, floating spreads, account equity, and active position mark-to-market tracker.
  • Model Inference: Live directional forecast $\hat{y}$, router Shannon entropy $H(g)$, and domain weight gauges (Tech %, Macro %, Fund %).
  • Auto Self-Improvement: Discrete Wavelet Energy Divergence (MRDD), episodic anomaly tracker, and ReCAP policy delta library.
  • Daily Performance: Calendar-day trade attribution, daily hit rates, profit factors, and date filtering.