# zorrong/tradingview-webhook-mt5-bridge architecture

> Architecture diagram of the GitHub repository zorrong/tradingview-webhook-mt5-bridge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zorrong/tradingview-webhook-mt5-bridge
- Repository: https://github.com/zorrong/tradingview-webhook-mt5-bridge

## Overview

This is a Windows Forms TradingView-to-MetaTrader webhook bridge. A trader configures and starts the local listener, then TradingView alerts arrive as JSON, are checked and transformed into order instructions, and are relayed toward MetaTrader; the UI displays status and alert outcomes. The sampled C# shows the listener, request processing, named-pipe transmission, and UI logging, but does not establish the full validation, risk, replay, or broker-side implementation. Those branches reflect README capabilities, not inspected implementation details.

Main entry points: [`TradingViewToMT5/Form1.cs`](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs) (Request handling), [`TradingViewToMT5/Program.cs`](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Program.cs) (App entry), [`TradingViewToMT5/Form1.Designer.cs`](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.Designer.cs) (Status and alerts), [`TradingViewToMT5`](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5) (JSON validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_program["App entry<br/>[Program.cs]"]
  node_main_ui["Bridge UI<br/>[Form1.cs]"]
  node_status_view["Status and alerts<br/>[Form1.Designer.cs]"]
end

subgraph group_alert["Alert handling"]
  node_listener["Webhook listener<br/>[Form1.cs]"]
  node_request_handler["Request handling<br/>[Form1.cs]"]
  node_json_checks["JSON validation"]
  node_template_mapping["Template and symbols"]
  node_alert_rules["Alert safeguards"]
  node_audit_replay["Audit and replay"]
end

subgraph group_execution["Order execution"]
  node_risk_sizing["Risk sizing"]
  node_order_router["Order routing"]
  node_named_pipe["Named-pipe relay<br/>[Form1.cs]"]
end

node_trader(("Trader"))
node_tradingview(("TradingView"))
node_metatrader["MT4 / MT5"]

node_program -->|"opens"| node_main_ui
node_trader -->|"configures"| node_main_ui
node_trader -->|"starts"| node_listener
node_tradingview -->|"posts alerts"| node_listener
node_listener -->|"dispatches"| node_request_handler
node_request_handler -->|"checks payload"| node_json_checks
node_request_handler -->|"maps fields"| node_template_mapping
node_request_handler -.->|"applies rules"| node_alert_rules
node_request_handler -.->|"records alert"| node_audit_replay
node_request_handler -.->|"sizes order"| node_risk_sizing
node_request_handler -.->|"routes order"| node_order_router
node_request_handler -->|"transmits command"| node_named_pipe
node_named_pipe -.->|"relays to"| node_metatrader
node_request_handler -->|"updates alert"| node_status_view
node_main_ui -->|"controls"| node_listener

click node_program "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Program.cs"
click node_main_ui "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs"
click node_status_view "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.Designer.cs"
click node_listener "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs"
click node_request_handler "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs"
click node_json_checks "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_template_mapping "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_alert_rules "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_audit_replay "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_risk_sizing "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_order_router "https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5"
click node_named_pipe "https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs"

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_program,node_main_ui,node_status_view,node_tradingview toneBlue
class node_listener,node_request_handler,node_json_checks,node_template_mapping,node_alert_rules,node_audit_replay toneAmber
class node_risk_sizing,node_order_router,node_named_pipe toneMint
class node_trader,node_metatrader toneIndigo
```

## Components

### Desktop app

- [App entry](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Program.cs): `TradingViewToMT5/Program.cs`
- [Bridge UI](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs): `TradingViewToMT5/Form1.cs`
- [Status and alerts](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.Designer.cs): `TradingViewToMT5/Form1.Designer.cs`

### Alert handling

- [Webhook listener](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs): `TradingViewToMT5/Form1.cs`
- [Request handling](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs): `TradingViewToMT5/Form1.cs`
- [JSON validation](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`
- [Template and symbols](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`
- [Alert safeguards](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`
- [Audit and replay](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`

### Order execution

- [Risk sizing](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`
- [Order routing](https://github.com/zorrong/tradingview-webhook-mt5-bridge/tree/main/TradingViewToMT5): `TradingViewToMT5`
- [Named-pipe relay](https://github.com/zorrong/tradingview-webhook-mt5-bridge/blob/main/TradingViewToMT5/Form1.cs): `TradingViewToMT5/Form1.cs`

### Other components

- **Trader**
- **TradingView**
- **MT4 / MT5**

## Connections

- App entry → Bridge UI: opens
- Trader → Bridge UI: configures
- Trader → Webhook listener: starts
- TradingView → Webhook listener: posts alerts
- Webhook listener → Request handling: dispatches
- Request handling → JSON validation: checks payload
- Request handling → Template and symbols: maps fields
- Request handling → Alert safeguards: applies rules
- Request handling → Audit and replay: records alert
- Request handling → Risk sizing: sizes order
- Request handling → Order routing: routes order
- Request handling → Named-pipe relay: transmits command
- Named-pipe relay → MT4 / MT5: relays to
- Request handling → Status and alerts: updates alert
- Bridge UI → Webhook listener: controls
