# TradingView to MetaTrader. Alerts in, orders out.

Source: https://pipsocket.com/tradingview-to-metatrader

Paste one webhook URL into a TradingView alert. Each time it fires, Pipsocket places the order on every MetaTrader account you picked, with your sizing and stops, and keeps a trace.

$15 per account, per month. MT5 today, MT4 next.

- [Connect an account](https://app.pipsocket.com)
- [TradingView docs](https://docs.pipsocket.com/tradingview)

## TradingView alert

The webhook URL has the form `https://hooks.pipsocket.com/t/{hook}/{secret}`. The dashboard builds the message for you, with TradingView's placeholders in place.

An indicator alert:

```json
{
  "action": "open",
  "event_id": "k3f9-ema-{{exchange}}:{{ticker}}-{{interval}}-open-buy-{{time}}",
  "sent_at": "{{timenow}}",
  "symbol": "{{exchange}}:{{ticker}}",
  "side": "buy",
  "risk": { "percent": 1 },
  "sl": { "pips": 20 },
  "tp": { "pips": 40 }
}
```

A strategy alert:

```json
{
  "action": "strategy",
  "event_id": "k3f9-ema-{{exchange}}:{{ticker}}-{{interval}}-{{strategy.order.id}}-{{time}}",
  "sent_at": "{{timenow}}",
  "symbol": "{{exchange}}:{{ticker}}",
  "position": {
    "from": "{{strategy.prev_market_position}}",
    "from_size": "{{strategy.prev_market_position_size}}",
    "to": "{{strategy.market_position}}",
    "size": "{{strategy.market_position_size}}"
  },
  "sl": { "pips": 25 },
  "tp": { "pips": 50 }
}
```

One alert, received and placed on three accounts, each sized its own way:

```
IC Markets   #50213    buy 0.42 EURUSD   filled 1.08412
Pepperstone  #881204   buy 0.38 EURUSD   filled 1.08413
OANDA        #6091233  buy 1.10 EURUSD   filled 1.08412
```

## How hooks behave

- **One alert, many accounts.** Point a hook at up to 20 MetaTrader accounts. Each one sizes the trade its own way.
- **Size by risk, not only lots.** Fixed lots, a multiplier, or a percent of the account worked out from your stop.
- **Late alerts don't open trades.** An open older than 30 seconds is refused. An exit always goes through.
- **A trace for every alert.** What arrived, what each account did, and the reason anything was refused.

## Everything an alert can do.

The dashboard builds the message for you, with TradingView's placeholders in place. Paste it into the alert and you're done.

### Actions

- `open`: a market or pending entry, with stops and targets
- `close`: close a position, all of it or a portion
- `reverse`: close and open the other way in one alert
- `modify`: move stops and targets on open positions

### Strategies, sizing and stops

- `strategy`: follow a Pine strategy's position exactly
- `close_all`: flatten what the hook opened on a symbol
- `risk`: size from a percent or a cash amount at the stop
- `tp`: one target, or a ladder of partial closes
- `trailing`: trailing stops and break-even that follow price

Every message field: https://docs.pipsocket.com/tradingview-messages (every docs page as Markdown: https://docs.pipsocket.com/llms.txt).

## From alert to filled order. Three steps, no bridge EA.

### Connect your MT5 login

Server, login and password, from any MT5 broker. Your terminal starts next to your broker's trade server and stays on.

### Make a hook

Pick the accounts it trades and how each one sizes. You get a webhook URL and a ready-made message.

### Paste it into TradingView

URL under the alert's webhook setting, message in the message box. Works for indicators and strategies.

## Why not a bridge EA on your own VPS?

|                      | Webhook bridge EA on a VPS                     | Pipsocket TradingView hooks                          |
| -------------------- | ---------------------------------------------- | ---------------------------------------------------- |
| Hosting              | A Windows VPS to rent, patch and log into      | Nothing to host. We run the MT5 terminal.            |
| When it hangs at 3am | Alerts fire into nothing until you notice      | Restarted and reconnected; the next alert lands      |
| Late alerts          | Filled whenever they arrive, at whatever price | Opens over 30 seconds old refused, exits always sent |
| Several accounts     | An EA and a setup in every terminal            | One hook, up to 20 accounts, each sized its own way  |
| When something's off | Dig through the EA's journal on the VPS        | A trace per alert and account, with the reason       |

## TradingView to MetaTrader questions

### How do I connect TradingView to MetaTrader?

Make a hook in Pipsocket, then paste its webhook URL and message into a TradingView alert. When the alert fires, the order goes to your MetaTrader accounts. No EA, no VPS.

### Which TradingView plan do I need?

One that can send webhook alerts, which TradingView keeps for its paid plans. Nothing else is needed on the TradingView side.

### Does it work with Pine strategies and indicators?

Both. Indicator alerts send actions like open and close. Strategy alerts can follow the strategy's position exactly, sized your way.

### What if an alert arrives late or twice?

Every alert carries an event id, so a repeat is ignored. Opens older than 30 seconds are refused; exits always go through.

### What does it cost?

$15 per account, per month. TradingView hooks are included, with no per-alert fees.

## The same account, other ways in

- [MetaTrader WebSocket API](https://pipsocket.com/metatrader-websocket-api.md) (`wss://wss.pipsocket.com`): ticks, fills and deals pushed as they happen.
- [MetaTrader REST API](https://pipsocket.com/metatrader-rest-api.md) (`api.pipsocket.com`): orders, positions and history over HTTPS.
- [MetaTrader MCP server](https://pipsocket.com/metatrader-mcp-server.md) (`mcp.pipsocket.com`): let Claude or any agent read and trade your account.
