Latest Updates
If you are running the TradingView bot v2.0, make sure to add the "pair" argument in the alert message.
Overview
We will see how to configure TradingView Alerts in order to automate your trades with the Quadency TradingView Bot.
Details
Basic BolBands - with entire capital and market orders
This is a basic strategy that involves the Bollinger Bands technical indicator. It consists of buying when the price crosses below the lower band and sell when the price crosses over the upper band.
Step 1: Get your bot started
Get your bot ready as we’ve seen in this article.
Step 2: Create your alerts
Go to your TradingView account and open the chart for the symbol you wish to trade. In this example, we're trading XRP/BTC.
Click Indicators and Strategies and search "Bollinger Bands" for this example, and click Bollinger Bands from the list (indicator, not Strategy).
Click Alerts in the right sidebar, and click "Create Alert"
Define your alert conditions as appropriate. In this case, we want to create two distinct alerts, one to buy and one to sell.
To create a buy alert:
Select Crossing Down, Bollinger Band, Lower
In Options, select "Once Per Bar".
Select Open-Ended
Paste in your Webhook URL
Click save
To create a sell alert:
Select Crossing up, Bollinger Band, upper
In Options, select "Once Per Bar".
Select Open-Ended
Paste in your Webhook URL
Click save
Congrats, your alerts are created, however, the message is still empty so your bot will not be able to transform the signals into trades.
Step 3: Configure the messages
Remember, the goal of our strategy is to enter a long position (buy) when the price crosses below the lower band and to close the position (sell) when the price crosses the upper band. We want to use our entire starting capital.
Create the message to open a position
As we want to use our entire starting capital and place a market order, we can simply use the BUY action.
{
"action": "BUY",
"botId": "1234"
}
Create the message to close the position
Here we can use the “close_position” action of the bot.
{
"action": "CLOSE_POSITION",
"botId": "1234"
}
Now all you need to do is to copy/paste each of the messages into the respective TradingView Alerts.
2. Price averaging + take profit
The goal of this strategy is to buy x amount of an asset and average its cost and have two take profits
Step 1: Plan your strategy and get your bot started
Get your bot ready as we’ve seen in the first part of this article.
In this strategy, we want to
purchase 1 BTC
Buy at 0.2 at $40,000
Buy at 0.3 at $37,000
Buy at 0.5 at $35,000
Take profit at $45,000
Note: make sure your Starting capital is >$40,000
Step 2: Create your alerts
Go to your TradingView account and open the chart for the symbol you wish to trade. In this example, we're trading BTC/USD.
Click Alerts in the right sidebar, and click "Create Alert"
Define your alert conditions as appropriate. In this case, we want to create two distinct alerts, one to buy and one to sell.
Buy Alerts
Select Crossing Down, BTCUSD, 40,000
Select Every Time
Select Open-Ended
Paste in your Webhook URL
Click save
Repeat the process to create the two other buy alerts.
Take Profit alert
Select Crossing Up, BTCUSD, 45,000
Select Every Time
Select Open-Ended
Paste in your Webhook URL
Click save
Congrats, your alerts are created, however, the message is still empty so your bot will not be able to transform the signals into trades.
Step 3: Configure the messages
Remember, the goal of our strategy is to enter a long position (buy) when the price crosses below $40,000 and start to take profit from $42,000.
Buy orders
Buy message #1
{
"action": "BUY",
"amount": 0.2,
"botId": "1234"
}
Buy message #2
{
"action": "BUY",
"amount": 0.3,
"botId": "1234"
}
Buy message #3
{
"action": "BUY",
"amount": 0.5,
"botId": "1234"
}
Take Profit Order
{
"action": "CLOSE_POSITION",
"botId": "1234"
}
Note: Alternatively, you could use a sell action. However, as the price fluctuates, it might hit your target profit before you purchase 1 BTC. As Sell messages need to have a specified amount, there's a risk the bot tries to sell 1 BTC while you have less than this amount, creating an insufficient funds error and not taking a profit.
Now all you need to do is to copy/paste each of the messages into the respective TradingView Alerts.
If you are looking for more advanced strategies, take a look at this article on how to run the TradingView bot using Strategies.