Skip to main content
TradingView Bot

Use this bot to trade based on signals received from your TradingView account. Execute your custom strategy by defining alert conditions...

Quadency Customer Service avatar
Written by Quadency Customer Service
Updated over a week ago

Latest Updates

  • You may now add a "perc_of_total" message in your alert message. It gives you the option to specify a percentage of your starting capital to serve as your order amount.

  • In making sure that the alert messages that you will use to send orders from your Tradingview to your Tradingview bot are properly formatted, you can use the JSON Formatter.


This bot can be used to turn alerts from TradingView into executable signals. Once activated, the bot monitors incoming messages from your TradingView account and executes the desired action in real-time (buy, sell, close position, stop bot etc).


TradingView is a popular charting platform for traders and investors of all experience levels. It features 100s of built-in technical indicators and allows users to create and share custom indicators. Alerts can be defined based on these indicators as well as price levels, which in turn can be sent to third parties such as Quadency for automating actions based on certain events.

How does it work?

The TradingView Bot monitors alerts from your TradingView account and executes the desired action in real-time. Alerts can be triggered based on one or multiple indicators as well as price levels.

As you can see in the graphic above:

  1. The TradingView bot receive alerts from TradingView

  2. The TradingView bot reads the message included in the Alert

  3. The Bot places an order according to the message

How to Get Started

Whether you are using a simple alert or a combination of indicators using TradingView Strategies, the first steps to get your bot started are the same.

Start the TradingView Bot

1. Select TradingView bot from the Available Bots list
2. Select the Exchange, Account, and Quote Currency​ to trade

  • The Quote Currency is USDT in BTC/USDT or ETH/USDT

  • Please note you will only be able to trade on market pairs sharing the same Quote Currency. If you select USDT to trade ETH/BTC and BTC/USDT, the bot will fail.

3. Specify a Starting Capital

  • Note: Starting Capital is used as the "cash" available to the bot to buy when an amount is not specified. This value must be specified in quote currency, in this example, we're trading XRP/BTC, and thus the quote currency is BTC. The value here represents the "capital" to measure your performance against, and balances will not be validated to give users the flexibility to trade with any amounts. This means you are responsible for ensuring sufficient balances are available in your account. Insufficient balance will result in errors shown in the logs.

4. Click Start Live to start the bot

5. Once started, look for this message in the logs:

The bot is now ready to receive messages from your TradingView account.

Configure the Alert Messages in Trading View

The tradingView bot monitors incoming messages from your TradingView account via Alert messages. There are two ways to set up alerts, please follow the two guides below accordingly:

  • TradingView Alerts via a single Indicator.

  • TradingView Strategies using Pine Scripts in combination with the AlertCondition function.

In this article we are going to use Alerts, if you wish to use Strategies, please go through this article.

6. Go back to the Parameters tab and copy your personal Webhook URL

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

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

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

9. Define your alert conditions as appropriate. In this case we look for XRP/BTC price crossing below the lower band of Bollinger Bands. In Options, select "Once Per Bar".

10. Paste in your Webhook URL (Note: this is a Pro features in TradingView - currently $15/mo)

11. Paste in the message to send to the bot once this alert is triggered. In this example, we are buying 10 XRP/BTC when the condition is met. Click Save.

12. That's all! You're ready to receive signals from TradingView. Each time a signal is received, the bot will output the raw message in logs so you can confirm what is being sent.

  • Note: You can find two more examples here.

Supported Actions

To place an order, the alert message must contain certain fields. As seen below, the TradingView Bot currently supports four fields

  • BotId: Define which bot will receive the alert (mandatory)

  • Pair: Define which pairs the bot will trade (mandatory)

    • must be indicated as "BASE/QUOTE", example:

      • BTC/USDT

      • ETH/USDT

  • Action: Define the action taken by the bot (mandatory)

    • BUY: place a buy order

    • SELL: place a sell order

    • Close_Position: sell or buy back entire position depending on the side (long or short)

    • Stop_bot: stop the bot completely, it will ignore open orders and alerts

  • Amount: define the amount per order (optional)

  • Price: define the entry price of a limit order (optional)

  • perc_of_total: define the percentage (in decimal) of your order amount based on your starting capital.
    Example: Starting capital: 1000 USDT, perc_of_total: 0.5. This means the bot will use 50 % of the starting capital, meaning 500 USDT.

Here are the possible actions supported at this time:

Market order

To place a market order using the entire "Starting Capital":

"action": "BUY",
"pair": "BTC/USDT",
"botId": "1234"

In the example above, if you are trading BTC/USDT, and your starting capital is 1,000 USDT, the bot will send a Market order to buy BTC with 1,000 USDT.

Note - if your first action is SELL, an amount must be specified.

To place a market order for a specific amount of Base Currency (BTC):

"action": "BUY",
"amount": 0.02,
"pair": "BTC/USDT",
"botId": "1234"

In the example above, if you are trading BTC/USDT, the bot will send a Market order to buy exactly 0.02 BTC, regardless of the Starting Capital set.

To place a market order for a specified percentage of your starting capital:

"action": "Buy",
"perc_of_total": 0.1,
"pair": "BTC/USDT",
"botId": "1234"

In setting the number of the "perc_of_total", it should be set in the decimal form of your percentage. In the case above, 0.1 is 10%. To calculate the decimal form of your percentage, it would be (percentage/100).

Limit Order

To place a limit order, include the price parameter:

"action": "BUY",
"pair": "BTC/USDT",
"price": 16000,
"amount": 0.02,
"botId": "1234"

Similarly, if you omit (exclude) the amount field, but specify a price, the bot will send a Limit Order to buy BTC using starting capital at the price defined. Also, you can replace the amount field with "perc_of_total" if you want to specify a percentage of your starting capital.

Note: You can use dynamic price by using variables in the message as shown in this article.

Replace "BUY" with "SELL" to place a sell order. The bot will execute every order sent, so if it already bought 10, and another message comes in to BUY 10 again, it will send an order to the exchange to buy 10 more, making the total position 20.

Note: Position, in this case, is simply a tracking mechanism - it does not imply a margin/futures "position", but simply a way to track the total exposure in either direction (long, short).

Close Position

To close an open position:

"action": "CLOSE_POSITION",
"pair": "BTC/USDT",
"botId": "1234"

A long position is closed by selling the entire unsold quantity bought. In the example above, an order to sell 20 will be sent. In the case of a short position, where you initially sold a certain amount, an order to buy will be sent. This is useful if your strategy involves averaging in at certain levels but you are not able to keep track of the entire quantity.

  • Example 1:

  1. Buy 1 $BTC

  2. Close position = Sell 1 $BTC

  • Example 2:

  1. Buy 1 BTC

  2. Sell 0.8 BTC

  3. Buy 0.3 BTC

  4. Close position = Sell 0.5 BTC (1-0.8+0.3=0.5)

Stop Bot

And finally, you also have the ability to stop the bot by sending the following message:

"action": "STOP_BOT",
"botId": "1234"

Once the bot is stopped, it will no longer monitor messages from TradingView.

Note: You can create multiple copies of this bot and run them on different pairs, just be careful to use the correct BotID. Additionally, if your strategy trades both sides (long and short), it's ideal to create two separate bots for each so there are no conflicts.

How to trade multiple pairs with one bot?

In order to trade multiple pairs with the same bot, all you need to do is to create multiple alert messages for each market pair you want to trade. It's important to keep a few things in mind:

  • You can only add one pair per alert message.

  • The market pairs must all share the same Quote currencies.

  • You need to ensure having enough capital to trade on these multiple pairs.

That's all! If you have any questions or want to provide feedback, reach us via Live Chat below.

You might be interested in

Did this answer your question?