TradeSgnl Logo
TradeSgnl
Docs
Portal

Low-Code Alert Setup

Learn how to add alert functionality to TradingView scripts for automated trading

Introduction


This guide shows you how to modify existing TradingView strategy scripts to send automated trading signals to your MT5 EA via TradeSgnl. You'll learn how to add alert functionality to your Pine Script strategies to enable automated trading.

What You'll Learn
  • Add visual confirmation arrows to your charts

    Create clear visual indicators for trade entries and exits

  • Format alert messages for TradeSgnl EA

    Ensure reliable communication between TradingView and your MT5 platform

  • Configure dynamic alerts with advanced parameters

    Include risk settings, stop-loss, take-profit, and other trading parameters

This guide is ideal for traders who already have custom TradingView strategies and want to connect them to TradeSgnl EA for automated execution. We'll walk through the process step-by-step, from adding visual indicators to configuring webhook alerts.

Adding Visual Confirmation


Before adding alert functionality, it's helpful to add visual confirmation arrows to your chart. These arrows provide a clear visual cue for trade entries and exits, making it easier to understand when your alerts will trigger.

Using plotshape() for Visual Signals

TradingView's plotshape() function allows you to display icons or arrows on your chart when specific conditions are met. We'll use it to show buy and sell signals.

Buy Signal Arrow
plotshape(longCondition, style=shape.labelup, 
  location=location.belowbar, 
  color=color.new(#046ff9, 0), 
  size=size.large, 
  text='TradeSgnl \n Buy', 
  textcolor=color.new(color.white, 0))
Sell Signal Arrow
plotshape(shortCondition, style=shape.labeldown, 
  location=location.abovebar, 
  color=color.new(#046ff9, 0), 
  size=size.large, 
  text='TradeSgnl \n Sell', 
  textcolor=color.new(color.white, 0))
Implementation Steps

To add visual confirmation to your strategy script, follow these steps:

Finding Your Entry Conditions

Find the code where strategy.entry is called. The condition that triggers this is your entry condition.

if ta.crossover(fast, slow)  // This is your condition
    strategy.entry('long', strategy.long)

In this example, ta.crossover(fast, slow) is the entry condition you'll use for your visual confirmation.

Adding the Visual Arrows

Once you've identified your entry conditions, add the plotshape() calls to the end of your script:

Complete Example:
Strategy with Visual Indicators
//@version=5
strategy("TradeSgnl MA Crossover Strategy", overlay=true)

// Calculate moving averages
fastMA = ta.sma(close, 20)
slowMA = ta.sma(close, 50)

// Plot moving averages
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")

// Define entry conditions
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)

// Strategy entries
if longCondition
    strategy.entry("Long", strategy.long)

if shortCondition
    strategy.entry("Short", strategy.short)

// Visual confirmation arrows
plotshape(longCondition, style=shape.labelup, location=location.belowbar, 
  color=color.new(#046ff9, 0), size=size.large, 
  text='TradeSgnl \n Buy', textcolor=color.new(color.white, 0))
  
plotshape(shortCondition, style=shape.labeldown, location=location.abovebar, 
  color=color.new(#046ff9, 0), size=size.large, 
  text='TradeSgnl \n Sell', textcolor=color.new(color.white, 0))
Example of TradeSgnl arrows on a TradingView chart
TradeSgnl arrows showing buy and sell signals on a chart
Tip

The visual arrows are just for reference on your chart and don't affect the strategy's performance metrics. They help you confirm that your alerts will trigger at the right times.

Adding Alert Functions


With visual confirmation in place, the next step is to add alert functionality to your strategy script. These alerts will send trading signals to your TradeSgnl EA when your strategy's conditions are met.

Adding Custom Alert Messages

Simply add these input fields to your strategy:

Alert Message Inputs
// License code and alert message inputs
licenseCode = input.string(title="License Code", defval="YOUR-LICENSE-CODE", group="Alerts")
longEntryAlert = input.string(title="Long Entry Alert", defval="Long Entry Signal", group="Alerts")
longExitAlert = input.string(title="Long Exit Alert", defval="Long Exit Signal", group="Alerts")
shortEntryAlert = input.string(title="Short Entry Alert", defval="Short Entry Signal", group="Alerts")
shortExitAlert = input.string(title="Short Exit Alert", defval="Short Exit Signal", group="Alerts")
Using Alerts in Your Strategy

After adding the input fields, use them in your strategy logic:

Using Alert Messages
// In your strategy logic
if (longCondition)
    strategy.entry("Long", strategy.long)
    alert(licenseCode + "," + longEntryAlert, alert.freq_once_per_bar_close)

if (exitLongCondition)
    strategy.close("Long")
    alert(licenseCode + "," + longExitAlert, alert.freq_once_per_bar_close)

if (shortCondition)
    strategy.entry("Short", strategy.short)
    alert(licenseCode + "," + shortEntryAlert, alert.freq_once_per_bar_close)

if (exitShortCondition)
    strategy.close("Short")
    alert(licenseCode + "," + shortExitAlert, alert.freq_once_per_bar_close)
Tip

Make sure to include your license code, symbol, and action at the beginning of each alert message. The custom alert text will be added at the end.

Complete Example with Alerts
Complete Strategy with Alerts
//@version=5
strategy("Simple Strategy with Custom Alerts", overlay=true)

// License code and alert message inputs
licenseCode = input.string(title="License Code", defval="YOUR-LICENSE-CODE", group="Alerts")
longEntryAlert = input.string(title="Long Entry Alert", defval="Long Entry Signal", group="Alerts")
longExitAlert = input.string(title="Long Exit Alert", defval="Long Exit Signal", group="Alerts")
shortEntryAlert = input.string(title="Short Entry Alert", defval="Short Entry Signal", group="Alerts")
shortExitAlert = input.string(title="Short Exit Alert", defval="Short Exit Signal", group="Alerts")

// Example strategy (simple moving average crossover)
fastMA = ta.sma(close, 10)
slowMA = ta.sma(close, 20)

// Strategy conditions
longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)

// Strategy entries and exits with custom alerts
if (longCondition)
    strategy.entry("Long", strategy.long)
    alert(licenseCode + "," + longEntryAlert, alert.freq_once_per_bar_close)

if (shortCondition and strategy.position_size > 0)
    strategy.close("Long")
    alert(licenseCode + "," + longExitAlert, alert.freq_once_per_bar_close)

if (shortCondition)
    strategy.entry("Short", strategy.short)
    alert(licenseCode + "," + shortEntryAlert, alert.freq_once_per_bar_close)

if (longCondition and strategy.position_size < 0)
    strategy.close("Short")
    alert(licenseCode + "," + shortExitAlert, alert.freq_once_per_bar_close)

// Plot indicators
plot(fastMA, color=color.blue)
plot(slowMA, color=color.red)

Signal Parameters


When setting up your alert messages, you can include various parameters to customize how trades are executed by your TradeSgnl EA. Here's a guide to the most common parameters and how to use them.

Using Custom Alert Inputs

After adding the alert message inputs to your script as shown in the Alert Functions section, you'll see these fields in your strategy settings. These inputs make it easy to configure your signals:

Custom alert inputs in TradingView strategy settings
Custom alert inputs for signal configuration
Tip

You only need to enter action parameters (buy, sell, closebuy, etc.) and any optional parameters in the alert message inputs. Your license code is automatically prepended to create the complete signal message.

Basic Signal Structure

Every TradeSgnl alert message follows this basic structure:

LicenseID,SYMBOL,ACTION,risk=VOLUME,[OPTIONAL_PARAMS]

For example:

LicenseID,EURUSD,buy,risk=0.01
Common Signal Parameters
ParameterDescriptionExample
symbolSymbol for the tradeEURUSD, GBPUSD, etc.
actionAction to performbuy, sell, closebuy, closesell
riskPosition size in lots or risk percentagerisk=0.01
slStop Loss in points/pipssl=50
tpTake Profit in points/pipstp=100
commentTrade comment (use quotes)comment=Strategy 1
Signal Examples
Basic Buy Signal:
LicenseID,EURUSD,buy,risk=0.01
Buy with Stop Loss and Take Profit:
LicenseID,EURUSD,buy,risk=0.01,sl=50,tp=100
Sell Signal with Comment:
LicenseID,GBPUSD,sell,risk=0.02,tp=120,comment=MA Cross
Close Sell Positions:
LicenseID,EURUSD,closesell

Alert Configuration


Once you've added the alert code to your script, you need to create the actual alert in TradingView and configure it to send signals to your TradeSgnl EA.

Step-by-Step Alert Setup
Step 1: Open Alert Dialog

Click the Alerts Button in the top toolbar of your TradingView chart to open the alert creation dialog.

TradingView alert button location
Click the Alerts Button in the top toolbar
Step 2: Configure Alert

Select your script name and "alert() functions calls only" from the dropdown menus. This ensures your custom alert message will be sent when the condition is triggered.

TradingView alert condition configuration
Configure alert conditions and select 'alert() functions calls only'
Step 3: Set Webhook URL
In the Notifications tab, enable 'Webhook URL' and enter https://webhook.tradesgnl.com as the destination for your alerts. This connects TradingView to your TradeSgnl EA.
TradingView webhook URL configuration
Enable Webhook URL and enter https://webhook.tradesgnl.com
Important Alert Settings
Testing Your Alert

After setting up your alert, follow these steps to test it:

1. Use a Demo Account

Always test your alerts with a demo trading account first to ensure they're working correctly before using real funds.

2. Check EA Logs

Monitor your MT5 EA's logs to verify that alerts are being received and processed correctly by the EA.

3. Start with Small Positions

When testing with real accounts, use minimal risk settings (small position sizes) until you're confident in your alert configuration.

Tip

It's a good practice to create separate alerts for different signals (buy, sell, close long, close short). This makes it easier to manage your alerts and troubleshoot any issues.

Need Additional Help?

Our support team is ready to assist you with any questions you might have.

Email Support