Blog : How to Create Alerts on TradingView with a Strategy Script
Why Alerts are Important?
Setting up alerts in TradingView can make your trading experience more efficient. Alerts keep you informed about market changes, even when you're away from your screen. Whether you use them for personal notifications or for automating your trading activities, they give you the flexibility to react to market movements in real time. With alerts, you can capture opportunities or receive timely reminders based on your custom strategy.
If you're using the GetPineScript tool to generate custom TradingView strategy scripts, setting up alerts is straightforward. Just be sure to enable the "Include Alerts" option in the "Visibility & Misc" section when configuring your strategy. Alerts can be useful both for manual monitoring and auto-trading with platforms that support webhook notifications. In this guide, we'll walk you through the steps to create alerts for your strategy script.
Step-by-Step Guide to Setting Alerts in TradingView with a Strategy Script
- 1 Apply the Strategy Script to Your Chart. If you're unsure how to add Pine Script source code to your chart, simply follow the instructions.
- 2 Open Strategy Settings and Navigate to "Alert Messages"
Once the strategy is applied, click on the gear icon to open the Strategy Settings. Inside the settings menu, find the "Alert Messages" section. This is where you configure the content of the alert message based on your strategy's orders.
- 3 Adjust the Message Boxes.
In the "Alert Messages" section, you'll see message boxes for different order types like "Entry", "Exit", "Take-Profit", "Stop-Loss". Customize the content in these boxes if necessary. These messages will be sent when the conditions for the specific strategy orders are met. You can view the available parameters for alert messages by hovering over the info box, where a tooltip will display the options you can use.
- 4 Add an Alert on the Chart. Make sure to select the asset and timeframe for which you want to receive alerts.
Go to your chart's toolbar and click "Add Alert". This will bring up the alert creation window, where you can configure the alert for your strategy script.
- 5 Name Your Alert and Set the Message.
Enter a relevant "Alert Name" for easy reference. In the "Message" field, leave the default value as
{{strategy.order.alert_message}}
. This ensures that the alert message you configured earlier in the strategy settings will be sent when the alert is triggered. - 6 Configure Notifications.
Switch to the "Notifications" tab. Here, you can choose how you want to be notified. Options notify in app, email notifications, SMS, or webhook integration, which is useful for automating trades with third-party services.
- 7 Click Create.
Once everything is configured, click "Create". Your alert is now live and will trigger based on the conditions you've set in the strategy script.
- 🎉 Congratulations! That's it! With these steps, you can create alerts using your custom strategy scripts generated with GetPineScript. If you make any parameter changes in the settings, be sure to delete the old alert and create a new one, otherwise, the alert will trigger based on your previous setup.