# jpxproject/jev-mt5-hft-framework architecture

> Architecture diagram of the GitHub repository jpxproject/jev-mt5-hft-framework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jpxproject/jev-mt5-hft-framework
- Repository: https://github.com/jpxproject/jev-mt5-hft-framework

## Overview

JEV-MT5 Sentinel combines a MetaTrader 5 trading runtime with a local Python decision bridge. The principal flow runs from market ticks through state and pricing, applies hard risk vetoes, and executes trades; the bridge supplies AI or local-rule judgments and composes actions. Separate capabilities include a web dashboard, native chart HUD, and an autonomous MT5 co-pilot. MQL module interactions are represented from the README topology; unsampled implementation details are not inferred.

Main entry points: [`bridge/bridge_server.py`](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/bridge_server.py) (FastAPI Bridge), [`mql5/Include/JevState.mqh`](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevState.mqh) (Market State), [`mql5/Include/JevRiskEngine.mqh`](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevRiskEngine.mqh) (Risk Veto Engine), [`bridge/gemini_client.py`](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/gemini_client.py) (Market Evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mt5["MT5 Trading Runtime"]
  node_ea["Trading Expert<br/>[JevLoop_HFT_EA.mq5]"]
  node_state["Market State<br/>[JevState.mqh]"]
  node_pricing["Reservation Pricing<br/>[JevPricing.mqh]"]
  node_risk["Risk Veto Engine<br/>[JevRiskEngine.mqh]"]
  node_fallback["MQL Fallback<br/>[JevFallback.mqh]"]
  node_execution["Order Execution<br/>[JevLoop_HFT_EA.mq5]"]
end

subgraph group_bridge["Decision Bridge"]
  node_bridge_server["FastAPI Bridge<br/>[bridge_server.py]"]
  node_gemini["Market Evaluation<br/>[gemini_client.py]"]
  node_local_rules["Local Rules Evaluator<br/>[gemini_client.py]"]
  node_strategy["Action Composer<br/>[strategy.py]"]
end

subgraph group_monitoring["Monitoring Interfaces"]
  node_web_dashboard["Web Dashboard<br/>[index.html]"]
  node_chart_hud["Chart HUD"]
  node_watchdog["Bridge Watchdog<br/>[watchdog_247.py]"]
end

subgraph group_autonomous["Autonomous Co-pilot"]
  node_copilot["Co-pilot Daemon"]
  node_trade_ledger[("Co-pilot Trade Events")]
end

node_tick(("Market Ticks"))
node_gemini_service{{"Gemini API"}}
node_broker{{"MT5 Broker"}}

node_tick -->|"triggers"| node_ea
node_ea -->|"updates state"| node_state
node_state -->|"sends snapshot"| node_bridge_server
node_bridge_server -->|"requests evaluation"| node_gemini
node_gemini -.->|"queries"| node_gemini_service
node_gemini -->|"falls back"| node_local_rules
node_bridge_server -->|"composes action"| node_strategy
node_strategy -->|"returns action"| node_bridge_server
node_bridge_server -->|"sends signal"| node_pricing
node_pricing -->|"prices orders"| node_risk
node_risk -->|"permits trades"| node_execution
node_execution -->|"places orders"| node_broker
node_risk -.->|"veto freezes"| node_state
node_state -->|"feeds display"| node_chart_hud
node_bridge_server -->|"serves dashboard"| node_web_dashboard
node_watchdog -->|"restarts if unhealthy"| node_bridge_server
node_copilot -->|"executes trades"| node_broker
node_copilot -.->|"records events"| node_trade_ledger

click node_ea "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Experts/JevLoop_HFT_EA.mq5"
click node_state "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevState.mqh"
click node_pricing "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevPricing.mqh"
click node_risk "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevRiskEngine.mqh"
click node_fallback "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevFallback.mqh"
click node_execution "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Experts/JevLoop_HFT_EA.mq5"
click node_bridge_server "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/bridge_server.py"
click node_gemini "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/gemini_client.py"
click node_local_rules "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/gemini_client.py"
click node_strategy "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/strategy.py"
click node_web_dashboard "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/static/index.html"
click node_chart_hud "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Indicators/JevSentinel_HUD.mq5"
click node_watchdog "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/watchdog_247.py"
click node_copilot "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/copilot_trader_daemon.py"
click node_trade_ledger "https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/copilot_ledger.jsonl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ea,node_state,node_pricing,node_risk,node_fallback,node_execution toneBlue
class node_bridge_server,node_gemini,node_local_rules,node_strategy toneAmber
class node_web_dashboard,node_chart_hud,node_watchdog,node_gemini_service toneMint
class node_copilot,node_trade_ledger toneRose
class node_tick,node_broker toneIndigo
```

## Components

### MT5 Trading Runtime

- [Trading Expert](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Experts/JevLoop_HFT_EA.mq5): `mql5/Experts/JevLoop_HFT_EA.mq5`
- [Market State](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevState.mqh): `mql5/Include/JevState.mqh`
- [Reservation Pricing](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevPricing.mqh): `mql5/Include/JevPricing.mqh`
- [Risk Veto Engine](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevRiskEngine.mqh): `mql5/Include/JevRiskEngine.mqh`
- [MQL Fallback](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Include/JevFallback.mqh): `mql5/Include/JevFallback.mqh`
- [Order Execution](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Experts/JevLoop_HFT_EA.mq5): `mql5/Experts/JevLoop_HFT_EA.mq5`

### Decision Bridge

- [FastAPI Bridge](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/bridge_server.py): `bridge/bridge_server.py`
- [Market Evaluation](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/gemini_client.py): `bridge/gemini_client.py`
- [Local Rules Evaluator](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/gemini_client.py): `bridge/gemini_client.py`
- [Action Composer](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/strategy.py): `bridge/strategy.py`

### Monitoring Interfaces

- [Web Dashboard](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/static/index.html): `bridge/static/index.html`
- [Chart HUD](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/mql5/Indicators/JevSentinel_HUD.mq5): `mql5/Indicators/JevSentinel_HUD.mq5`
- [Bridge Watchdog](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/watchdog_247.py): `bridge/watchdog_247.py`

### Autonomous Co-pilot

- [Co-pilot Daemon](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/copilot_trader_daemon.py): `bridge/copilot_trader_daemon.py`
- [Co-pilot Trade Events](https://github.com/jpxproject/jev-mt5-hft-framework/blob/main/bridge/copilot_ledger.jsonl): `bridge/copilot_ledger.jsonl`

### Other components

- **Market Ticks**
- **Gemini API**
- **MT5 Broker**

## Connections

- Market Ticks → Trading Expert: triggers (evidence: `README.md`)
- Trading Expert → Market State: updates state (evidence: `README.md`)
- Market State → FastAPI Bridge: sends snapshot (evidence: `README.md`)
- FastAPI Bridge → Market Evaluation: requests evaluation (evidence: `bridge/bridge_server.py`)
- Market Evaluation → Gemini API: queries
- Market Evaluation → Local Rules Evaluator: falls back (evidence: `bridge/gemini_client.py`)
- FastAPI Bridge → Action Composer: composes action (evidence: `bridge/bridge_server.py`)
- Action Composer → FastAPI Bridge: returns action (evidence: `README.md`)
- FastAPI Bridge → Reservation Pricing: sends signal (evidence: `README.md`)
- Reservation Pricing → Risk Veto Engine: prices orders (evidence: `README.md`)
- Risk Veto Engine → Order Execution: permits trades (evidence: `README.md`)
- Order Execution → MT5 Broker: places orders (evidence: `README.md`)
- Risk Veto Engine → Market State: veto freezes (evidence: `README.md`)
- Market State → Chart HUD: feeds display (evidence: `README.md`)
- FastAPI Bridge → Web Dashboard: serves dashboard (evidence: `bridge/bridge_server.py`)
- Bridge Watchdog → FastAPI Bridge: restarts if unhealthy (evidence: `bridge/watchdog_247.py`)
- Co-pilot Daemon → MT5 Broker: executes trades (evidence: `bridge/copilot_trader_daemon.py`)
- Co-pilot Daemon → Co-pilot Trade Events: records events
