Automating TradingView Strategies with Superhook
Welcome to the Superhook integration guide, where we'll walk you through the process of linking your TradingView strategies with Bonsai's trading bots for an automated and efficient trading experience
Introduction to Superhook
Superhook is Bonsai's innovative solution that connects TradingView's technical analysis software to your trading bot. By utilizing webhook technology, Superhook listens for alerts from your TradingView strategies and instantly triggers trades on your behalf, bridging the gap between analysis and execution.
Step-by-Step Integration Guide
Step 1: Strategy Application
Firstly, make sure you have a TradingView strategy applied to your chart. A strategy on TradingView is a set of predefined conditions that dictate your entry and exit points in the market. If you haven’t done so already, you can find a wide variety of strategies in TradingView's public library or create your own or access Bonsai tools for TradingView.
Step 2: Alert Creation
Once your strategy is in place, it’s time to create an alert. Go to the TradingView chart where your strategy is applied, and click on the alert icon to access the alert configuration panel. In this panel, you'll need to specify the conditions that will trigger your alert. Select the condition that corresponds to the strategy script currently in operation. If additional options are presented, opt for "Order fills only" to ensure the alert is triggered by actual order executions, enhancing the precision of your trade automation.
Step 3: Payload Configuration
Inside the alert configuration, you’ll find a field to enter a message – this is where you paste the JSON payload. This JSON snippet is the key instruction that tells Superhook which bot to activate and what action to take.
JSON Payload Example:
Make sure to replace your_private_token
and your_bot_id
with your actual Superhook token and the specific Bonsai Bot ID. Do not share your private token.
The {{syminfo.basecurrency}}
, {{syminfo.currency}}
, {{strategy.market_position}}
, {{strategy.order.action}}
and {{strategy.order.contracts}}
variables are dynamically updated by TradingView.
Step 4: Webhook URL Activation
For a Bonsai Bot to receive alerts from TradingView, you need to enable webhooks. Check the 'Webhook URL' option within the alert settings and enter the following URL: https://api.superhook.io
. This ensures that when the alert is triggered, the signal is sent directly to your Bonsai Bot via Superhook.
Step 5: Alert Activation
After entering all the details, save the alert. This will make it active, and your Bonsai Bot will start executing trades based on the signals received from your TradingView strategy.
Troubleshooting
Alerts Not Triggering: Verify that the alert conditions are set correctly and that the webhook URL is correctly entered.
Incorrect Trades: Double-check the JSON payload for accuracy, particularly the
token
andbot_id
.
Last updated