Topics: metatrader5, mql5, pine-script, expert-advisor, mql4, metatrader, forex-trading, automated-trading, webhook, tradingview, tradingview-webhook, alert-bot, auto-trading, mt4, mt5, trading-bot, tradingview-to-mt5, mt5-webhook-bridge, pine-script-mt5
TradingView to MT5 / MT4 webhook bridge for traders who design strategies in Pine Script and want them executed on a real broker account. The project receives TradingView alerts as JSON, validates them, applies risk rules, and routes them to MetaTrader as live orders, with full logging and a no-code template editor.
Webhook-driven bridge that turns TradingView alerts into live MT5 / MT4 orders, with JSON templates, risk sizing, and full execution audit.
TradingView gives you the best charts and Pine Script gives you strategy logic, but MetaTrader is where the broker lives.
This project closes the gap with:
- A local webhook listener
- A JSON alert template editor
- A direct route from alert to MT5 / MT4 fill
TradingView to MT5/MT4 receives Pine Script alerts and converts them into broker orders with deterministic, auditable rules.
| Module | Description |
|---|---|
| Webhook Listener | Local HTTPS endpoint for alerts |
| JSON Validator | Schema-checked alert payloads |
| Template Engine | Maps fields to order parameters |
| Risk Sizer | Lot from balance / equity / fixed |
| Order Router | Sends to MT5 / MT4 broker |
| Replay Log | Every webhook stored & replayable |
| Feature | Description |
|---|---|
| Local Webhook | TLS-ready endpoint |
| JSON Templates | Visual field mapping |
| Multi-Strategy | Per-strategy routing rules |
| Symbol Mapper | TradingView symbol to broker |
| Lot Modes | Fixed / % balance / Pine-supplied |
| MT4 / MT5 Support | Platform selection system |
| Replay Tool | Re-fire any past alert |
| Time Filter | Block alerts outside session |
| Duplicate Guard | Same alert ignored within N sec |
| Health LED | Listener status indicator |
- Stateless per request, idempotent on retries
- Rejects unsigned / malformed payloads
- Replay never duplicates live orders
- Survives platform reconnects cleanly
Requirements:
- Windows 10 / 11
- .NET 8+
- Visual Studio 2022
git clone https://github.com/your-username/tradingview-to-mt5.gitOpen solution → Press F5
- Launch app
- Select MT4 / MT5
- Enter broker login
- Start webhook listener
- Copy URL into TradingView alert
- Paste JSON template body
- Click ARM ALERTS
- Fire alerts and watch fills
[TV] {"symbol":"EURUSD","side":"buy","sl":1.0830,"tp":1.0890}
[HOOK] POST /alert 200 OK
[MAP] broker symbol = EURUSD.r
[ORDER] #128973 FILLED 1.0852
- Green row = filled
- Yellow row = validated, waiting fill
- Red row = invalid / rejected
- Gray row = duplicate suppressed
- Webhook listener
- JSON templates
- Order router
- Real MT5 bridge
- Cloud relay node
- Multi-broker fan-out
- Strategy stats dashboard
1. Fork
2. git checkout -b feature/new-feature
3. git commit -m "Add feature"
4. git push
5. Open PR
MIT
TradingView to MT5/MT4 · v1.0

