Gunbot Webhook v25 – TradingView Alerts Overview
Check out the latest v25 beta with Gunbot webhook integration for the Tradingview alerts module
Tv alerts it’s a module that allows you to connect your gunbot with your tradingview.com account and use specific indicators or create your own strategy directly in tradingview.com using pine code, those alerts will be triggered almost immediately in your gunbot after they are signaled in your tv strategy/indicator.
The TradingView alerts module has been upgraded to support webhook integration, this specific module unlocks if your license is Gunbot Ultimate or you buy the tv addon from a gunbot reseller nearby, after that your license will be automatically updated and you will be able to use TradingView alerts with your gunbot.
Webhooks allow you to send a POST request to a certain URL every time an alert is triggered from your tradingview account. This feature can be enabled when you create or edit an alert in your tradingview chart. Add the public IP of your gunbot and tradingview will send a request as soon as the alert is triggered.
Gunbot – TradingView configuration
- Click in the 3 dots in the top menu of the Gunbot GUI (at least you must run v24.2.7 and gunbot Ultimate license or TV addon enabled) and select TradingView alerts.
- Click in the tab Webhooks and fill the port, the webhook port must be 443 and use some good password with letters, numbers and some odd characters just to avoid someone trying to hack into your gunbot server.
- Then click SAVE Changes in the top menu.
TradingView – how to create the Alert
You must open any chart you would like to create an alert in your tradingview account then you can create an alert simply with the right mouse button and setting up the type of alert, usually, alerts are used with some specific strategy that you can create with pine code or as well you could use some premium indicator, in the market there’s many of them and they’re already configured to place the alerts based in their strategy.
TIP: press ALT+A in the chart and you will be able to create the alert.
below you can see the list of options you must enable in order to send the alert correctly.
- Tick the webhook URL option and type the public IP of your gunbot followed by the 443 port. (ex. https://123.456.78.9:443)
In the Message textbox you must fill those parameters below.
- the passcode for the webhook authorization.
- the exchange you want to send the alert (ex. binanceFutures).
- The type of trade (buy, sell, long, short).
- The pair you would like to trade (ex. USDT-BTC).
- The amount you would like per trade (ex. 50).
- The price you would like to execute the alert, my recommendation use a market order, so just set 0 and it will send as market.
- The alert will be triggered when the indicator/strategy you use fires it, and immediately the tv system will connect with your gunbot that will execute it.
TradingView Alerts settings in Gunbot
the image with the config below it’s suitable to be used in USDT futures markets.
Be sure to add at least 1 pair from the exchange you want to send the alerts. It’s possible to configure only allow to buy with the alert for example and just sell with gunbot or in a more restricted mode that gunbot it’s a pure zombie from your tv alerts system then set the pair disabled, and you can send an alert to any PAIR, don´t need to be added in the trading-settings page as long as there’s at least 1 pair configured for each exchange you want to send an alert.
You can use tv alerts in spot markets and futures markets as well just will change the declaration of the order in the tradingview alert buy/sell or long/short and some specific settings in the TV alerts page in the GUI that are used in spot or futures.
You can enable TV_protection for spot trading, it means even your tv strategy signal and triggers the sell of the coin you bought as a stop limit trigger, declared in your code/indicator, for example, gunbot will check if the price is below breakeven and don´t execute the alert, be careful with that if your TV strategy/indicator has a stop-loss option.
Networking and security settings to take into consideration
It’s mandatory to open the port 443 in your firewall/router and your computer, here is how to do it under different OS systems, in the router you will need to find out as each router will have its own interface.
As we are using port 443 and usually that’s locked in the system, you must open in your firewall/router and in the computer running gunbot as well, if you’re running Gunbot from home, you must enable napt and route wan port 443 to ip in your lan to port 443 to the private ip of the computer.
On your Windows computer
- Click “Windows Defender Firewall with Advanced Security”.
- Click on Inbound Rules in the left panel.
- Add a new rule, select port, click next select TCP and type 443 in the port.
- Select Allow the connection, click next.
- Set a name and click Finish.
On your Linux computer or VPS
Linux systems depend on the firewall you’re using, if you’re using the common ufw just type in your terminal.
As it’s a very common port used it’s better to add some security to who we allow to connect to our gunbot so if you want to restrict what ips are able to connect to the webhook listener you can use that command:
sudo ufw allow from 188.8.131.52 to any port 443
that’s one of the public IPs from the tradingview.com portal, in total, for now, there are 4 servers from tradingview.com that will communicate with your gunbot to post alerts.
so just launch the command per each IP.
after you can check it’s correctly setup with
sudo ufw status
Depending on the vps provider it’s possible you need to configure a 2nd tier firewall, for example amazon web service or google cloud, you will need to create another rule in their network configuration interfaces.
What SSL Library you should use
I did a test under Linux and windows, in Linux with the openssl certification manager it did work without a hassle, so it launch webhook correctly with the created certificate from openssl, but for some windows distributions seems the openssl it’s too old and gunbot stuck after an error then you must use LibreSSL 3.2.2 or above.
You can compile it yourself or use those simple steps.
- Click the Start button, and type powershell – click the right mouse button & launch as Administrator
- Copy and paste the code below into the powershell console.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1’))
- After in the same powershell window copy and paste this command and press intro
choco install -confirm libressl
- Depending on your Windows distribution it’s possible you still get an error and your gunbot stuck, then download LibreSSL Portable 3.3.3.
- Unzip and extract folder in C:\libressl
If all is good when you launch gunthy-win it must show at init this :
That’s all folks, c-u next time, enjoy the Gunbot webhook integration and happy bot trading.