# apakle/telegram-mt5-signal-bot architecture

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

- Interactive diagram: https://gitdiagram.com/apakle/telegram-mt5-signal-bot
- Repository: https://github.com/apakle/telegram-mt5-signal-bot

## Overview

This repository runs Telegram-to-MetaTrader signal automation: channel messages are parsed into JSON files that an MT5 Expert Advisor uses to place broker trades. It includes both regex-based signal bots for two broker configurations and an LLM-based zone parser. The Python excerpts show parsing and file writes; the README documents the downstream EA-to-trading workflow. The EA source files are present but were not sampled, so their individual file-reading behavior is not verified.

Main entry points: [`src/llm_telegram_signal2json_bot.py`](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/llm_telegram_signal2json_bot.py) (Zone LLM Parser), [`mql5/Experts/ForexeroSignalExecutor.mq5`](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/mql5/Experts/ForexeroSignalExecutor.mq5) (Forexero Executor), [`src/telegram_mt5_signal_bot_gold.py`](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot_gold.py) (PU Prime Listener), [`src/telegram_mt5_signal_bot.py`](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot.py) (Vantage Listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telegram Ingestion"]
  node_llm_listener["Zone Listener"]
  node_gold_listener["PU Prime Listener"]
  node_vantage_listener["Vantage Listener"]
end

subgraph group_parsing["Signal Parsing"]
  node_llm_parser["Zone LLM Parser"]
  node_gold_parser["Gold Signal Parser"]
  node_vantage_parser["Vantage Signal Parser"]
end

subgraph group_bridge["JSON Bridge"]
  node_zone_file[("Zone JSON File")]
  node_puprime_file[("PU Prime JSON File")]
  node_vantage_file[("Vantage JSON File")]
end

subgraph group_execution["MT5 Execution"]
  node_forexero_ea["Forexero Executor"]
  node_json_ea["JSON Signal Executor"]
end

node_telegram(("Telegram Channel"))
node_groq["Groq-Compatible API"]
node_broker["Broker Accounts"]

node_telegram -->|"sends messages"| node_llm_listener
node_telegram -->|"sends messages"| node_gold_listener
node_telegram -->|"sends messages"| node_vantage_listener
node_llm_listener -->|"processes text"| node_llm_parser
node_gold_listener -->|"parses messages"| node_gold_parser
node_vantage_listener -->|"parses messages"| node_vantage_parser
node_llm_parser -->|"requests extraction"| node_groq
node_llm_parser -->|"writes zones"| node_zone_file
node_gold_parser -->|"writes signal"| node_puprime_file
node_vantage_parser -->|"writes signal"| node_vantage_file
node_puprime_file -.->|"provides signal"| node_forexero_ea
node_vantage_file -.->|"provides signal"| node_forexero_ea
node_zone_file -.->|"provides zones"| node_json_ea
node_forexero_ea -->|"places trades"| node_broker
node_json_ea -->|"places trades"| node_broker

click node_llm_listener "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/llm_telegram_signal2json_bot.py"
click node_gold_listener "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot_gold.py"
click node_vantage_listener "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot.py"
click node_llm_parser "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/llm_telegram_signal2json_bot.py"
click node_gold_parser "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot_gold.py"
click node_vantage_parser "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot.py"
click node_forexero_ea "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/mql5/Experts/ForexeroSignalExecutor.mq5"
click node_json_ea "https://github.com/apakle/telegram-mt5-signal-bot/blob/main/mql5/Experts/SignalExecutorFromJson.mq5"

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_llm_listener,node_gold_listener,node_vantage_listener toneBlue
class node_llm_parser,node_gold_parser,node_vantage_parser toneAmber
class node_zone_file,node_puprime_file,node_vantage_file,node_groq toneMint
class node_forexero_ea,node_json_ea toneRose
class node_telegram,node_broker toneIndigo
```

## Components

### Telegram Ingestion

- [Zone Listener](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/llm_telegram_signal2json_bot.py): `src/llm_telegram_signal2json_bot.py`
- [PU Prime Listener](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot_gold.py): `src/telegram_mt5_signal_bot_gold.py`
- [Vantage Listener](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot.py): `src/telegram_mt5_signal_bot.py`

### Signal Parsing

- [Zone LLM Parser](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/llm_telegram_signal2json_bot.py): `src/llm_telegram_signal2json_bot.py`
- [Gold Signal Parser](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot_gold.py): `src/telegram_mt5_signal_bot_gold.py`
- [Vantage Signal Parser](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/src/telegram_mt5_signal_bot.py): `src/telegram_mt5_signal_bot.py`

### JSON Bridge

- **Zone JSON File**
- **PU Prime JSON File**
- **Vantage JSON File**

### MT5 Execution

- [Forexero Executor](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/mql5/Experts/ForexeroSignalExecutor.mq5): `mql5/Experts/ForexeroSignalExecutor.mq5`
- [JSON Signal Executor](https://github.com/apakle/telegram-mt5-signal-bot/blob/main/mql5/Experts/SignalExecutorFromJson.mq5): `mql5/Experts/SignalExecutorFromJson.mq5`

### Other components

- **Telegram Channel**
- **Groq-Compatible API**
- **Broker Accounts**

## Connections

- Telegram Channel → Zone Listener: sends messages (evidence: `src/llm_telegram_signal2json_bot.py`)
- Telegram Channel → PU Prime Listener: sends messages (evidence: `src/telegram_mt5_signal_bot_gold.py`)
- Telegram Channel → Vantage Listener: sends messages (evidence: `src/telegram_mt5_signal_bot.py`)
- Zone Listener → Zone LLM Parser: processes text (evidence: `src/llm_telegram_signal2json_bot.py`)
- PU Prime Listener → Gold Signal Parser: parses messages (evidence: `src/telegram_mt5_signal_bot_gold.py`)
- Vantage Listener → Vantage Signal Parser: parses messages (evidence: `src/telegram_mt5_signal_bot.py`)
- Zone LLM Parser → Groq-Compatible API: requests extraction (evidence: `src/llm_telegram_signal2json_bot.py`)
- Zone LLM Parser → Zone JSON File: writes zones (evidence: `src/llm_telegram_signal2json_bot.py`)
- Gold Signal Parser → PU Prime JSON File: writes signal (evidence: `src/telegram_mt5_signal_bot_gold.py`)
- Vantage Signal Parser → Vantage JSON File: writes signal (evidence: `src/telegram_mt5_signal_bot.py`)
- PU Prime JSON File → Forexero Executor: provides signal
- Vantage JSON File → Forexero Executor: provides signal
- Zone JSON File → JSON Signal Executor: provides zones
- Forexero Executor → Broker Accounts: places trades (evidence: `README.md`)
- JSON Signal Executor → Broker Accounts: places trades (evidence: `README.md`)
