Skip to main content
All CollectionsAutomated Trading Bots CenterCustom Strategies
How to run the TradingView bot using Alerts?
How to run the TradingView bot using Alerts?

Find two examples of strategies you can automate with Trading View Alerts.

Quad Team avatar
Written by Quad Team
Updated over a year ago

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

  1. Go to your TradingView account and open the chart for the symbol you wish to trade. In this example, we're trading XRP/BTC.

  2. Click Indicators and Strategies and search "Bollinger Bands" for this example, and click Bollinger Bands from the list (indicator, not Strategy).

  3. Click Alerts in the right sidebar, and click "Create Alert"

  4. Define your alert conditions as appropriate. In this case, we want to create two distinct alerts, one to buy and one to sell.

    1. To create a buy alert:

      1. Select Crossing Down, Bollinger Band, Lower

      2. In Options, select "Once Per Bar".

      3. Select Open-Ended

      4. Paste in your Webhook URL

      5. Click save

    2. To create a sell alert:

      1. Select Crossing up, Bollinger Band, upper

      2. In Options, select "Once Per Bar".

      3. Select Open-Ended

      4. Paste in your Webhook URL

      5. 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.

  1. Create the message to open a position

    1. 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"
}

  1. Create the message to close the position

    1. 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

  1. Get your bot ready as we’ve seen in the first part of this article.

  2. In this strategy, we want to

    1. purchase 1 BTC

    2. Buy at 0.2 at $40,000

    3. Buy at 0.3 at $37,000

    4. Buy at 0.5 at $35,000

    5. Take profit at $45,000

  • Note: make sure your Starting capital is >$40,000

Step 2: Create your alerts

  1. Go to your TradingView account and open the chart for the symbol you wish to trade. In this example, we're trading BTC/USD.

  2. Click Alerts in the right sidebar, and click "Create Alert"

  3. Define your alert conditions as appropriate. In this case, we want to create two distinct alerts, one to buy and one to sell.

    1. Buy Alerts

      1. Select Crossing Down, BTCUSD, 40,000

      2. Select Every Time

      3. Select Open-Ended

      4. Paste in your Webhook URL

      5. Click save

      6. Repeat the process to create the two other buy alerts.

    2. Take Profit alert

      1. Select Crossing Up, BTCUSD, 45,000

      2. Select Every Time

      3. Select Open-Ended

      4. Paste in your Webhook URL

      5. 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.

You might be interested in

Did this answer your question?