Three simple steps to open, cancel or close the trade with custom signals from TradingView:
1. Create a DCA bot with TradingView custom signal Deal start condition and/or Deal close condition:
2. Use the messages from this bot to send the appropriate signal to this bot:
3. Create an alert on TradingView.com using the messages from p.2 above.
These steps in detail.
1. TradingView custom signal Deal start condition and/or Deal close condition.
How to create or edit a DCA bot with the needed deal start condition and other settings is described in this article:
It is impossible to combine other deal start conditions with the TradingView custom signal condition!
To close the trade with a custom signal, open the Conditions tab and choose TradingView custom signal condition:
2. Signal messages from the bot
You will need the signal messages to place in the alert created on TradingView.com.
There are many different messages, for example, to start the deal, close it at the market price, start the trailing, add funds, start or stop the bot, and many others to choose from:
Message for deal start signal
Starts a new deal as soon as the signal is received - if using with a Multi-pair bot, please specify the currency pair name
Message to close order at Market Price
Closes a running deal at the current Market Price. If your bot runs more than one deal, specify the currency pair name.
If the bot can open several trades with the same trading pair, this message will close ALL open trades with this pair.
Message to close all deals at Market Price
If your bot has multiple active deals, this command will close all deals for this bot at the current Market Price
Message to close all deals at Market Price and stop bot
If your bot has multiple active deals, this command will close all deals for this bot at the current Market Price and additionally disable (turn off) the bot
Message for deal add funds signal in the quote currency
Send this message when running, for example, a Long bot to buy more of the Base currency using the Quote currency. You can use this to add Safety Orders to Dollar Cost Average or add funds to a winning position and increase the trade size. You need to edit the message and specify the exact amount of Quote currency to add (so if you are trading BTC/USDT the Quote currency is USDT).
Optionally you can specify the price of the Add Funds order. It will look like this:
Message for deal add funds signal in the base currency
Send this message when running, for example, a Short bot to sell more of the Base currency. You can use this to add Safety Orders to Dollar Cost Average or add funds to a winning position and increase the trade size. You need to edit the message and specify the exact amount of Base currency to add (so if you are trading BTC/USDT the Base currency is BTC).
Optionally you can specify the price of the Add Funds order. It will look like this:
Message to cancel the deal
Will cancel the deal and you will keep any currency bought (or for a short bot, keep the funds released).
If using this command on a Multi-pair bot, please specify the currency pair to cancel the deal for
Message to cancel all bot deals and stop the bot
Cancels all active deals running for this bot and additionally stops (turns off) the bot
Message to cancel all active deals
Cancels (not closes) all active deals for this bot
Message to start bot*
Message to stop bot*
Simple commands to stop or start a specific bot.
Typically used if you have your bot configured with a built-in Deal Start Condition, like QFL or RSI-7 and you are using a TradingView indicator when the market conditions change to enable the bot to start trading and stop it when the market conditions are unfavourable
Message to start bot and deal
Typically used if you configured your bot to use built-in Deal Start Condition (like "Open new deal asap"), you can start the bot and open a new deal immediately
To use this command, you must have Trailing Take Profit enabled and configure with a Trailing deviation percentage in your bot's configuration.
Warning: when the bot receives this command, it will immediately start Trailing Take Profit, but only if the trade is in a profitable area!
Message to start all long bots on account*
Message to start all short bots on account*
These messages can be used to start all of your Long bots, or Short bots, created for this specific exchange account
Message to stop all long bots on account*
Message to stop all short bots on account*
These messages can be used to stop all of your Long bots, or Short bots, created for this specific exchange account
* These messages can Start and Stop the bots even if different Deal start condition is chosen!
In the Single pair bot, you just need to copy and paste the message. But in the Composite bot, you will need to edit the message and specify the pair this signal should be intended for. Also please note, that the pair for Spot market and Futures market look different - USDT_BTC for Spot and USDT_BTCUSDT for Futures.
Here are examples of different messages:
Message to close deal at Market Price is useful just to stop one active deal on a bot - can be used for Single-pair bots. If using it for a Multi-pair bot, don't forget to include the name of the asset being traded in the message to ensure the correct deal is closed!
Also, if you allow opening several trades on the same pair, ONE message to close the specific pair's deal will close ALL deals with this trading pair.
Similar to Add Funds message - it will add funds to all deals for this trading pair.
Message to close all deals at Market Price is useful only if you have multiple active deals for the bot that you want to close all at the same time - it can be used for Multi-pair bots:
To find the signal messages, you need to click on the bot's name from any place, like active deals, history page, My bot's page, etc:
After opening the bot's information page, scroll down till you see this section with messages:
Choose the needed message and copy it. To copy the message, you can simply click the hyperlinked text for Message to close all deals at Market Price (for example) and it will be automatically copied into your device's clipboard for you!
Please pay attention again: for a Multi-pair bot you should edit the bot command text and specify the exact pair you want to send a signal for.
3. Create an alert on the TradingView.com website.
To create the alert for the Trading View custom signal using the webhook (or simply hook), you will need to have at least the lowest-paid subscription on TradingView.com.
Open an Alert settings
On the chart page for the specific pair, there is an Alert button that you can click on, and you will see a pop-up with parameters for a new alert.
You can also right-click on the chart, choose Add alert and the same window will appear to configure the alert settings:
Adjust the Conditions to trigger the alert
This set-up is only up to your own strategy and imagination! You can try to find more ideas on the internet or on the TradingView forums.
When creating alerts on TradingView, enable Webhook URL, then paste this link: https://app.3commas.io/trade_signal/trading_view
Name an alert and paste the message
Choose an appropriate and unique name so you won't get confused in the future!
The Message field on the alert's settings page should contain text taken from the Messages section on the bot view page on 3Commas. Sorry, but once again - for the Single-pair bot the text should be copied without changes; for the Multi-pair bot, the pair should be changed to the desired one when the alert is triggered:
Then click the Create button.
The alert will be displayed on the Manage alerts panel on the right sidebar menu:
When the alert is triggered according to the settings you have entered, the signal will be sent to 3Commas via Webhook. If the other bot's conditions let it happen, the corresponding action will take place, like opening new deal, closing the deal at market price, etc., depending on what exactly was pasted to the Message field.
When the signal is received, the new deal will be opened if this is possible.
The new deal will not be opened if:
The bot is not enabled;
The maximum active deals limit is reached;
The trade start condition has been changed to another;
The currency pair in the signal for a Multi-pair bot is not present in the bot's configuration within its pairs list.
Please pay attention that the alerts on TradingView can be one-time or repeated (Every Time, like Once Per Bar). Alerts of Every Time kind can be triggered repeatedly with small intervals between them (it depends on the alert trigger conditions you choose) and will, therefore, try to trigger new deals or opened deals to be closed with a Market Order. This situation is common, but please keep this in mind when you choose repeated alerts and check if this effect is the desired one.
Also, you can create one alert with several signal messages from different bots. To do this, you can enclose the bot messages with [ and ] and separate multiple messages with a comma. For example:
Switching off custom signals
If you want to switch off custom TradingView signals for the specific bot, you should either switch this bot off completely, use the Stop button on the DCA Bot page, or change the Deal start condition, or disable the alert on TradingView.com.
Have a look at our guide for Reversing your bot from Long to Short (and vice versa) - here you will learn how to flip trade direction and also how to use multiple bot commands with one TradingView alert!