Creating Alerts
Set up TradingView webhook alerts to send signals to PineHook.
TradingView alerts can send a webhook message to PineHook when they trigger. PineHook validates the signal and forwards it to your EA, which executes the trade on your MT5 terminal.
Requirements#
TradingView Plan#
Webhooks require a paid TradingView plan.
| Plan | Webhooks |
|---|---|
| Free | No |
| Essential | Yes |
| Plus | Yes |
| Premium | Yes |
| Ultimate | Yes |
No Webhook Option?
If you don't see the webhook option when creating an alert, your TradingView plan doesn't support webhooks. Check your plan on TradingView's pricing page.
Alert Limits#
Each plan has a different limit on active price alerts.
| Plan | Price Alerts (per Month) |
|---|---|
| Essential | 20 |
| Plus | 100 |
| Premium | 400 |
| Ultimate | 1,000 |
Create an Alert#
Step 1: Open the Alert Dialog#
- Right-click on the chart and select Add Alert.
- Click the Alert button in the top toolbar.
- Press Alt+A.
Step 2: Set Alert Conditions#
Configure when the alert should trigger:
- A specific indicator crossing a value.
- Price crossing a level.
- A Pine Script condition.
Trigger frequency:
| Option | Description |
|---|---|
| Once Only | Fire once, then deactivate |
| Once Per Bar | Fire once per bar |
| Once Per Bar Close | Fire on bar close |
| Once Per Minute | Fire every time condition is true |
Step 3: Configure Webhook#
- Navigate to the Notifications tab.
- Check Webhook URL.
- Enter the PineHook webhook URL:
https://relay.pinehook.io/webhook
This URL is the same for all users. Your license key in the message body identifies your account and routes the signal to your EA.
Step 4: Write the Message#
- Navigate to the Message tab.
- Enter your signal using CSV or JSON format:
YOUR_LICENSE_KEY,buy,{{ticker}},size_lots=0.1,sl_pips=50,tp_pips=100CSV:
YOUR_LICENSE_KEY,buy,{{ticker}},size_lots=0.1,sl_pips=50,tp_pips=100JSON:
{
"license": "YOUR_LICENSE_KEY",
"action": "buy",
"symbol": "{{ticker}}",
"size_lots": 0.1,
"sl_pips": 50,
"tp_pips": 100
}JSON (minified):
{"license":"YOUR_LICENSE_KEY","action":"buy","symbol":"{{ticker}}","size_lots":0.1,"sl_pips":50,"tp_pips":100}Use Placeholders
{{ticker}} automatically inserts the chart's symbol. See the full list of placeholders below.
See Signal Commands for all available commands and parameters.
Step 5: Name and Create#
- Give your alert a descriptive name.
- Click Create.
TradingView Placeholders#
Placeholders insert dynamic values into your alert message at the time the alert fires.
| Placeholder | Description | Example Output |
|---|---|---|
{{ticker}} | Symbol name | EURUSD |
{{exchange}} | Exchange name | OANDA |
{{close}} | Close price | 1.0850 |
{{open}} | Open price | 1.0845 |
{{high}} | High price | 1.0855 |
{{low}} | Low price | 1.0840 |
{{volume}} | Volume | 1234 |
{{time}} | Alert time | 2024-01-15T10:30:00Z |
{{timenow}} | Current time | 2024-01-15T10:30:05Z |
{{interval}} | Timeframe | 15 |
{{strategy.order.alert_message}} | Custom message from a Pine Script alert_message parameter | (varies) |
This is not an exhaustive list. See TradingView's full placeholder reference for all available variables.
Pine Script Alerts#
Indicator Alerts#
Use the alert() function when your indicator detects conditions:
//@version=5
indicator("My Indicator Alerts")
buyCondition = ta.crossover(ta.sma(close, 10), ta.sma(close, 20))
sellCondition = ta.crossunder(ta.sma(close, 10), ta.sma(close, 20))
if (buyCondition)
alert('{"license":"YOUR_KEY","action":"buy","symbol":"' + syminfo.ticker + '","size_lots":0.1,"sl_pips":50,"tp_pips":100}', alert.freq_once_per_bar_close)
if (sellCondition)
alert('{"license":"YOUR_KEY","action":"sell","symbol":"' + syminfo.ticker + '","size_lots":0.1,"sl_pips":50,"tp_pips":100}', alert.freq_once_per_bar_close)
Strategy Alert Messages#
Pine Script strategies can use {{strategy.order.alert_message}} in the alert message field and define the actual signal in code via the alert_message parameter. This lets your strategy send dynamic signals based on real-time values like ATR, account balance, or indicator output.
var string license = "YOUR_LICENSE_KEY"
var string symbol = "EURUSD"
var string buyMessage = str.tostring(license) + ",buy," + str.tostring(symbol) + ",size_lots=0.1,sl_pips=50,tp_pips=100"
var string sellMessage = str.tostring(license) + ",sell," + str.tostring(symbol) + ",size_lots=0.1,sl_pips=50,tp_pips=100"
if (longCondition)
strategy.entry("Long", strategy.long, alert_message = buyMessage)
if (shortCondition)
strategy.entry("Short", strategy.short, alert_message = sellMessage)
For a full walkthrough with ATR-based examples and multi-signal strategies, see the Strategy Alert Messages guide.
Managing Alerts#
View Active Alerts#
Click the Alerts icon in the right panel to see all active alerts.
Edit an Alert#
- Find the alert in the Alerts panel.
- Click the gear icon.
- Make your changes.
- Click Save.
Updating Strategy Alerts
If you modify your Pine Script strategy's code or inputs, existing alerts will not update automatically. They continue firing based on the version active when the alert was created.
To update: edit the alert, click the Condition dropdown, and select your strategy from the bottom of the list. Updated strategies always appear at the bottom. Then save.

Pause or Delete an Alert#
Click the pause icon to temporarily disable an alert. Click the trash icon to delete it permanently.
Test Your Setup#
Before creating a live alert, use the two tools on the Signal Logs page in your dashboard. The signal format validator lets you paste any message and check it for errors. The EA connection test sends a signal through the full pipeline to confirm your EA is connected and ready to receive, without executing a trade. Both are the fastest way to catch problems before they affect real positions.
Send a Test Signal#
- Open any chart in TradingView.
- Create an alert with condition: Price greater than 0 (triggers at the next candle close).
- Enable webhook with a minimal signal:
YOUR_LICENSE_KEY,buy,EURUSD,size_lots=0.01
- Create the alert. It should trigger within seconds. Always use a demo account first.
Verify Signal Flow#
- TradingView alert fired — Open the Alerts panel and check the Log tab. The alert should appear with a timestamp and webhook message.
- PineHook received signal — Go to your dashboard, open Signal Logs, and find the signal by timestamp.
- EA received signal — In MT5, open the Experts tab and look for log entries from PineHook EA.
- Trade executed — Check the Trade tab in MT5 and verify the position appeared with the correct lot size, SL, and TP.
Common Issues#
Alert not firing:
- Confirm the alert is active and not paused or expired.
- Verify the condition is actually being met.
- Check your plan's alert limits.
Webhook not sent:
- Confirm the URL is exactly
https://relay.pinehook.io/webhook. - Confirm you have a paid TradingView plan.
- Check the TradingView alert log for errors.
Signal not in dashboard:
- Check your license key for typos.
- Verify the signal format is valid CSV or JSON.
- Confirm your PineHook subscription is active.
EA not receiving:
- Check the Experts tab for "Connected successfully".
- Confirm the license key in the alert matches the one in the EA.
- Ensure DLL imports are enabled in MT5.
Trade not executing:
- Confirm AutoTrading is enabled (toolbar button should be green).
- Check for sufficient margin.
- Verify the symbol exists on your broker.