Tutorials / Tradingview Alerts
Alert message fields
Every field an alert can carry, and what it does.
Where to find ready-made messages
Alert Templates has a message for each of these, with your license filled in. They show the format only: the conditions and the numbers are yours.
Action and size
| Field | What it does |
|---|---|
action | BUY, SELL, CLOSE (close trades) or MODIFY (opens nothing; moves the stop-loss or take-profit of open trades). |
lots | Fixed size, as typed in MT5. Each account's lot multiplier on Your MT5 still applies. |
risk, risk_type, risk_base | Size by money at risk instead of lots. risk_type is amount or percent; risk_base is balance or equity. The EA works the lots out from the stop-loss, so it needs one. |
strategy_number | Sends the alert to one Strategy ID only. |
Stop-loss, take-profit and trailing
| Field | What it does |
|---|---|
sl, tp | Distances from entry, in points by default. Both are optional: drop a line to trade without it. They go to the broker with the order, so they hold even if the terminal goes offline. |
sl_type, tp_type | Switch to pips or to a price. Pips work on forex and gold. Other symbols have no standard pip, so a pips alert there is refused and the reason shows on Failures. |
trail, trail_trigger | A trailing stop in points, starting once the trade is trail_trigger points in profit (0 means at once). The stop only moves forward, and the terminal must be running for it to move. |
tp_levels | A take-profit ladder as distance:percent steps. 200:50,400:30,600:20 closes half at 200 points, 30% more at 400 and the rest at 600. Distances must grow, percents must add to 100, and each step must be at least your broker's minimum lot. |
If the terminal closes or restarts mid-trade, the stop at the broker stays. Trailing and ladder steps carry on once the EA is running again.
Closing trades
close says which trades to close on a CLOSE alert, or what to close first on a BUY or SELL alert:
| Value | Closes |
|---|---|
opposite | Trades in the other direction on this symbol |
symbol | Every trade on this symbol |
last_symbol | The latest trade on this symbol |
last_any | The latest trade on any symbol |
all | Every trade |
Only trades this EA opened are closed. If a close fails, the new trade isn't opened.
Symbol names
Broker suffixes such as XAUUSD.c or XAUUSDm are matched automatically. If your broker uses a different name altogether, such as GOLD for XAUUSD, put your broker's exact name in the alert.
What's the same on every MT5
How a trade is managed travels in the alert, the same for every MT5 on the license set. The one thing set per MT5 is its lot multiplier, on Your MT5.
Related
This is how the software works, for education only: not investment advice, and not a recommendation to buy or sell anything. Symbols and numbers are examples of the format. Trading is risky. Diehard Trader carries out alerts and rules you set yourself.