Alert message examples you can copy and paste
The PipRoute alert message format with ready examples: fixed lots, risk percent, pending orders, break-even, trailing stops, partial closes and close all.
The Alert builder writes messages for you, but it helps to know what they say. Every message is a short line of values separated by commas:
LICENSE,command,SYMBOL,option=value,option=value
The licence is your account's licence from the dashboard (each MT5 account has its own). The examples below use 4F9A2C7B1D0E; replace it with yours. If you used PineConnector before, the layout is the same, so most of your old messages work with only the licence changed.
Open a trade
Buy 0.10 lots with a 20 pip stop loss and a 40 pip take profit:
4F9A2C7B1D0E,buy,EURUSD,vol_lots=0.10,sl_pips=20,tp_pips=40
Sell, sized so that hitting the stop loss costs 1% of your balance:
4F9A2C7B1D0E,sell,{{ticker}},vol_pct_bal_loss=1,sl_pips=25,tp_pips=50
Risk-based sizes need a stop loss, because the size is worked out from the distance to it. vol_dollar=50 risks 50 in your account currency instead of a percent.
Stops in pips, price or percent
Use whichever matches your indicator: sl_pips=20, sl_price=1.0850 or sl_pct=0.5. Take profit works the same with tp_. Stops are placed at the broker, so they still work if TradingView or your browser is closed.
Pending orders
A buy stop 10 pips above the current price:
4F9A2C7B1D0E,buystop,EURUSD,vol_lots=0.10,entry_pips=10,sl_pips=20,tp_pips=40
buylimit, sellstop and selllimit work the same way, with entry_pips, entry_price or entry_pct.
Protect a running trade
Move the stop to entry plus 1 pip once the trade is 15 pips in profit:
4F9A2C7B1D0E,buy,EURUSD,vol_lots=0.10,sl_pips=20,betrigger=15,beoffset=1
A trailing stop that starts at 20 pips profit, trails 10 pips behind and moves in 2 pip steps:
4F9A2C7B1D0E,buy,EURUSD,vol_lots=0.10,sl_pips=20,trailtrig=20,traildist=10,trailstep=2
Close trades
Close all buys on the symbol, or all sells, or both:
4F9A2C7B1D0E,closelong,EURUSD
4F9A2C7B1D0E,closeshort,EURUSD
4F9A2C7B1D0E,closelongshort,EURUSD
Close half of the open buys:
4F9A2C7B1D0E,closelongpct,EURUSD,pct=50
Close everything on the account (no symbol needed):
4F9A2C7B1D0E,closeall
Reverse a position
Close the sells and open a buy in one alert:
4F9A2C7B1D0E,closeshortopenlong,EURUSD,vol_lots=0.10,sl_pips=20
Useful extras
spread=2skips the trade when the spread is wider than 2 pips.comment=gold1tags the trade. A close with the same comment only touches trades with that tag.secret=yourwordis required if you set an alert password in Settings, so nobody who sees your licence can trade your account.eaoffandeaonpause and resume trading;closealleaoffcloses everything and pauses.
JSON works too
If your tools prefer JSON, send the same thing as an object:
{"license":"4F9A2C7B1D0E","cmd":"buy","symbol":"EURUSD","vol_lots":0.1,"sl_pips":20}