Case study · Expert Advisors & Integrations

    TradingView to MetaTrader Bridge

    A high-performance webhook gateway connecting TradingView charting alerts directly to MetaTrader 5 terminals. Features secure JSON payload verification, automated lot sizing calculations, and concurrent execution handles.

    Primary Tech
    Python / Flask
    API Integration
    MT5 & Webhooks
    Target Platform
    TradingView & MT5

    Client work under NDA. Client names, trading data, performance figures and live screens are not shown. This page describes the problem, what we built and the technology used.

    01

    The client

    Retail traders who build their signals in TradingView and trade on MetaTrader 5.

    02

    The problem

    Retail traders needed an automated way to execute TradingView alerts on MetaTrader 5 without custom EA programming.

    • Every TradingView alert had to be executed by hand in MT5, often minutes late.
    • The traders did not want to rewrite their Pine Script strategies as Expert Advisors.
    • Lot sizes were worked out by hand for each trade.
    • Some traders run several MT5 accounts and wanted one alert to trade all of them.
    03

    Our approach

    We built a webhook service between the two platforms. TradingView sends an alert, the service checks it, sizes the trade and places it in MT5.

    04

    How we built it

    1. 1

      Webhook listener

      A Flask service receives TradingView alerts as JSON. Each alert must carry a secret token, and anything malformed or unsigned is rejected.

    2. 2

      Alert queue

      Alerts go into a Redis queue, so a burst of alerts is never dropped, and a worker per MT5 terminal executes them in order.

    3. 3

      Lot sizing

      The lot size is calculated from the account's risk setting and the stop distance in the alert.

    4. 4

      Multi-account routing

      One alert can trade several MT5 accounts, each with its own risk settings.

    5. 5

      Slippage protection

      Before placing a trade, the service compares the current price with the alert price and skips the trade if it has moved past the trader's maximum deviation.

    05

    How we tested it

    • MT5 demo accounts receiving live TradingView alerts.
    • Duplicate and out-of-order alerts, to confirm each alert trades only once.
    • Terminal disconnection, to confirm queued alerts wait and then execute or expire.
    06

    What we delivered

    • The service deployed on a VPS next to the traders' MT5 terminals.
    • Setup instructions for TradingView alerts and MT5 accounts.
    • Support after launch.
    07

    The result

    The traders' TradingView alerts execute in MT5 automatically, sized to their risk, across all their accounts, without rewriting a single strategy.

    Features

    • Pine Script webhook listener
    • Auto lot sizing calculator
    • Multi-account routing
    • Slippage protection guard

    Technology

    • Python
    • MetaTrader 5 API
    • Flask
    • Redis

    Start here

    Need something similar?