Introduction

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

What is TradingView?

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 to Get Started

1) Select TradingView bot from the Available Bots list

2) Select the Exchange, Account and Market to trade

3) Specify a Starting Capital

Note: Starting Capital is used for performance reporting purposes only, it is NOT the maximum amount that the bot can spend. 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 simply 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. Let's continue with our example.

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

7) Goto 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.

Here are the possible messages supported at this time:

To place a market order:

{
"action": "BUY",
"amount": 10,
"botId": "1234"
}

To place a limit order, include the price parameter:

{
"action": "BUY",
"price": 0.00002190,
"amount": 10,
"botId": "1234"
}

Note: You can use dynamic price by using variables in the message as shown in this blog 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 messages 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).

To close an open position:

{
"action": "CLOSE_POSITION",
"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.

And finally, you also have a 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.

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

Note - This bot is available in the Quadency Pro plan. To upgrade your plan, click here.

Did this answer your question?