Skip to main content

How to Turn TradingView Alerts into Trades

The Gunbot TradingView add-on offers a powerful way to automate your trading by executing alerts generated from custom strategies in TradingView. This integration allows Gunbot to act on trade signals received via email or webhooks, streamlining your trading operations for maximum efficiency.

Why Automate TradingView Alerts with Gunbot?​

Automating TradingView alerts with Gunbot offers several benefits:

  • Seamless Integration: Connect your TradingView strategies directly to Gunbot.
  • Real-Time Execution: Respond to market changes instantly with automated trades.
  • Increased Efficiency: Reduce manual intervention and trade more effectively.
  • Enhanced Security: Keep your API secrets and trading strategies secure on your local device.
  • Great Exchange Connectivity: Gunbot supports a wide range of exchanges, ensuring you can trade on your preferred platforms. Check out the full list of compatible exchanges here.

Setting Up Your TradingView Alerts​

Start by setting up either the Gunbot IMAP listener or the Gunbot Webhooks receiver for TradingView alerts.

Gunbot Webhooks Setup​

Gunbot webhooks allow dispatching a POST request to a specified URL when a TradingView alert is triggered. To activate this feature, adjust alerts in your TradingView.com chart and include your Gunbot's public IP for prompt request sending upon alert activation.

To get started, you need to set up either the Gunbot IMAP listener or the Gunbot Webhooks receiver for TradingView alerts.

Gunbot Webhooks Setup​

Gunbot webhooks allow you to send a POST request to a specified URL when a TradingView alert is triggered. Follow these steps to set up webhooks:

  1. Configure Webhooks in Gunbot:

    • In the Gunbot interface, click the three dots in the header and select 'TradingView alerts'.
    • Go to the Webhooks tab and enter the required port number. Use port 443 for a secure SSL connection.
    • Enter a unique and secure password in the webhooks passphrase field. This passphrase is crucial for the alerts TradingView sends to Gunbot.
    • Save your configuration.
  2. Enable Webhooks in TradingView:

    • Open the chart for which you want to set an alert.
    • Right-click and select 'Add Alert'.
    • In the alert creation window, check the Webhook URL box and input https://[Your_Gunbot_IP]:443 (replace [Your_Gunbot_IP] with your actual Gunbot IP).
    • In the message field, provide the necessary details such as the passphrase, exchange, trade type, pair, amount, and price.

Networking and Security​

Ensure that port 443 is open on your firewall or router. Here’s how to set it up for different operating systems:

Windows Users​

  • Open Windows Defender Firewall with Advanced Security.
  • Create a new inbound rule for TCP port 443.
  • Allow the connection and name your rule.

Linux Users​

  • Use the ufw firewall to allow connections from TradingView’s IPs.
  • Execute sudo ufw allow from [TradingView_IP] to any port 443 for each TradingView IP.
  • Check your settings with sudo ufw status.

MacOS Users​

  • Use openssl to issue the required certificate.

SSL Library Choices​

TradingView requires a secure https connection for webhooks. You can use the default automatically created certificate or follow steps to enable HTTPS in the Gunbot interface.

Setting Up the IMAP Listener​

The IMAP listener method allows Gunbot to process TradingView alerts sent via email. Follow these steps to configure it:

  1. Access 'TradingView alerts' from the Gunbot header menu.
  2. Provide the necessary details:
    • User and Password: Gmail users should generate an 'App Password' as per Google’s instructions.
    • Host and Port: Default settings are usually correct for Gmail.
    • Authorized froms: Typically ["noreply@tradingview.com"]. Add more emails if needed.

Once configured, Gunbot will wait for TradingView alerts and execute them as they arrive.

Creating and Managing Alerts in TradingView​

Creating alerts in TradingView is straightforward. Here’s how:

  1. Open the chart of interest, with your indicators and/or strategy.
  2. Select and configure the desired alert type, often linked to strategies in Pine Script or premium indicators.
  3. Customize the alert conditions and message. Include essential details for Gunbot to execute the trade correctly, such as the passphrase, exchange, trade type, pair, amount, and price.

Conclusion​

Automating your trading with TradingView alerts and Gunbot can significantly enhance your trading efficiency and accuracy. By following this guide, you can set up and manage TradingView alerts effectively, leveraging Gunbot to automate your trading strategies. Whether you are new to automated trading or looking to optimize your existing setup, Gunbot offers the tools and flexibility to meet your needs.

Start automating your TradingView alerts today and take your trading to the next level with Gunbot! Don’t forget to check out the full list of exchanges supported by Gunbot here.