Pine Script · Strategies · Automation
Auto-trade any Pine strategy on MT5 — no extra Pine code
26 Aug 2026 · Updated 13 Oct 2026 · 8 min read

You do not need to rewrite a working Pine strategy to auto-trade it on MT5. TradingView already emits strategy alerts when an order fills. PineConnector reads that fill — including default English messages like order buy @ price filled on EURUSD — and turns it into a broker order.
{
"symbol": "{{ticker}}",
"action": "{{strategy.order.action}}",
"qty": 0.1,
"sl": 50,
"tp": 100,
"strategy_id": "{{strategy.order.id}}"
}sl and tp are distances in pips. Use sl_price and tp_price when the strategy already has absolute prices. The same message is documented in the webhook guide.
Strategy alerts vs indicator alerts
- Strategy alerts fire on
strategy.entry/strategy.closefills. Best default. Use{{strategy.order.action}}in JSON. - Indicator alerts fire on conditions you type (cross, once per bar). You must include
actionyourself (buyorsell). - Price-crossing alerts without JSON will be rejected as missing action. That is intentional.
Position flattening
Send close, closelong, or closeshort when the strategy exits. If MT5 is already flat, PineConnector treats "no matching positions" as a successful flatten rather than a failed trade — so your log does not scream at a no-op.
Lots when Pine does not send qty
When fixed lot is on, that size is used for every buy/sell — even if the alert already has qty. Turn on Risk % to size from equity and the alert stop instead; that needs sl (pips) or sl_price. If Risk % is on but the alert has no stop, the account falls back to fixed lot.
Close-on-reverse can close the opposite position before a new buy/sell, which matches how many Pine strategies flip. Turn it off if you hedge.
Map the ticker before the first live fill. Broker suffixes are covered in symbol mapping, and the brakes are in risk controls. Attach the EA or start the trial and fire one strategy alert on a demo login first.