This guide explains how to set up webhooks with TradingView to enable alerts to be sent directly to your Gunbot instance for automated trading. With webhooks, you can receive alerts and execute trades automatically without needing to manually enter orders.
Requirements
Before setting up the webhooks integration, you’ll need:
– A publicly accessible device running Gunbot on port 443
– LibreSSL installed to generate SSL certificate
– Webhooks enabled in Gunbot with a unique passphrase
– At least one valid trading pair added in Gunbot
Setting Up Alerts
Configuring TradingView Alerts
When creating alerts in TradingView, the message must follow this format to be properly interpreted:
passphrase exchange order_type pair amount price
The passphrase is what you set in Gunbot’s settings. The exchange, order type, pair, amount, and price define the trade to execute.
In other words: TradingView alerts should use this format:
passphrase exchange order_type pair amount price
Examples
passhere binance buy ETH-BTC 7 0.042
Sets a BUY Limit order on Binance for the pair ETH-BTC of 7 and price = 0.042
Order types are “BUY” or “SELL”
passhere binanceFutures short BTC-USDT 3 39400
Places a short on Binance Futures for the pair BTC-USDT – Amount = 3 and price = 39400
Order types are “short”, “long” or “close”
Available Settings
Currently only a small number of settings can be used in TradingView webhook alerts:
– TV_GB: Google Authenticator 2FA code if enabled
– TV_PROTECTION: Confirmation that trading is enabled if protections are on
These settings are formatted the same as in email alerts.
Troubleshooting
If you get SSL certificate errors on Windows, install LibreSSL:
- Open PowerShell as admin and run: Set-ExecutionPolicy Bypass -Scope Process
- Run: Set-ExecutionPolicy Bypass -Scope Process -Force; [Net.ServicePointManager]::SecurityProtocol = 3072; iex((New-Object Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1‘))
- Install LibreSSL: choco install libressl
Or download the DLL directly from https://sourceforge.net/projects/libressl-3-2-0-for-windows/files/LibreSSL-3.3.3_MinGW_Windows7%28static%29.zip/download and extract to c:/libressl
With webhooks properly configured, Gunbot will automatically execute your TradingView alerts!
Peter 3 December, 2023
Great tool, it works like a charm.