Skip to main content
All CollectionsMarketplaceTradingView Signals
How to use TradingView custom signals
How to use TradingView custom signals

Follow this guide to learn how to use your own custom TradingView.com Indicators to trigger, cancel and close your bot deals!

Updated this week

Before you move forward with this article...

If you have any feedback regarding this article, please fill out this Feedback form - this will help us update the article faster to meet your expectations and answer your questions.

If you are not sure about how to apply custom signals and look at this "walkthrough" blog post that shows a simple example of using the Hash Ribbons indicator from TradingView to open a new bot deal. You'll get a clear and straightforward overview of the process of using your own TradingView.com indicators to control your 3Commas bots!

Important note!

To create the alert for the custom signal using the webhook (or simply hook), you need to use a signal provider service that supports webhook communication. It can be TradingView, IFTTT, Zapier, or any other.

In this article, we will use TradingView.com as an example. To create an alert, you need to have at least the lowest-paid subscription.

Three simple steps to open, cancel or close the trade with custom signals from TradingView:

I. Create a DCA bot with TradingView custom signal Deal start condition and/or Deal close condition:

II. Use the messages from this bot to send the appropriate signal to this bot:

III. Create an alert on TradingView.com using the messages from p. II above.


These steps are in detail.

I. 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:

IMPORTANT NOTES:

  • 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 in the Take profit section and choose TradingView custom signal condition:


II. 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:

Bot Command

Description

Message for deal start signal

Starts a new deal as soon as the signal is received.

If using a Multi-pair bot, please specify the currency pair name in the message

Message to close order at Market Price

Closes a running deal at the current Market price.

If your bot runs multiple deals, specify the 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 volume of Quote currency to add (so if you are trading BTC/USDT the Quote currency is USDT).


IMPORTANT NOTES:

  • For adding funds in the Quote currency, please use the “volume” value.

  • If you send signals from TradingView to 3Commas to start the deal and Add Funds simultaneously (even with delay), it will not work. It is important to send those signals separately.

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


IMPORTANT NOTES:

  • For adding funds in the Base currency, please use the “amount” value.

  • If you send signals from TradingView to 3Commas to start the deal and Add Funds simultaneously (even with delay), it will not work. It is important to send those signals separately.

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


* These messages can Start and Stop the bots even if a different Deal start condition is chosen!

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

Start trailing

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.


* These messages can Start and Stop the bots even if a different Deal start condition is chosen!

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 a different Deal start condition is chosen!

Market or Limit order?

Normally the custom signals to add funds to active deals will create Market orders that execute immediately.

But now, you can create a Limit order for the Add Funds signal by specifying the price or the price deviation. Here is what it looks like:

{  
...
"price": 10.0
}

For "price," you need to specify the exact price for the pair where the bot should place an order.

or

{  
...
"price_percent": -5.5
}

For "price_percent," you need to input the value (without %) at what distance from the price when the signal was received the order should be placed.

Or you can add "price_percent_ref_type" parameter to specify what type of deviation you want to use:

  • current_price - this is the default setting - in this case, the price will be calculated from the current price when the signal was received. If you don't add this parameter, the price deviation will be calculated as usual.

  • base_entry_price - this price is calculated from the deal's Base order price.

  • avg_entry_price - this price is calculated from the average entry price of the deal.

Here are some details about using "price_percent" parameters:

  • "price_percent" value can be in this range: -99 – +1000 (without “%” symbol).

  • If you input both "price_percent" and "price", only the "price" parameter will count, and the percent will be ignored.

  • If you send the price higher than current for Long or lower than current for Sell, the order will be executed immediately by the market price.

Please note that these parameters are valid only for the Add Funds tool.

And remember - for adding funds in Quote currency, please use “volume” value and for adding funds in Base currency, please use “amount” value.

{
"action": "add_funds_in_quote",
"message_type": "bot",
"bot_id": 14214249,
"email_token": "xxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"delay_seconds": 0,
"pair": "USDT_XAR",
"volume": 20,
"price": 10
//don't add both "price" and "price_percent"
"price_percent": -5.5,
"price_percent_ref_type": "avg_entry_price"
}

Important addition!

If you have chosen TradingView custom signal as a Deal close condition, the message "close_at_market_price_all" or "close_at_market_price_all_and_stop_bot" will ignore any setting and close the trades even if the Minimum profit is turned on and is not reached. These tasks were developed when a trader urgently wants to close his bots and exit the trades as soon as possible. It is used as a "red emergency button" to save trades.


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.


III. Create an alert on the TradingView.com website.

1. Choose the pair and the exchange

Make sure on TradingView, that you chose the correct exchange and trading pair. Otherwise, the signals will not be correctly received by the bot or SmartTrade, even if they will be sent to 3Commas.

2. Add to the chart indicators and adjust them according to your needs and wishes

3. 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:

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

5. Enable Webhooks (valid only for DCA bots)

Open the Notifications tab and enable Webhook URL, then paste this link: https://app.3commas.io/trade_signal/trading_view

This webhook is valid only for DCA bots!
For Signal bots, the webhook is different (see here)!

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

DO NOT paste the sensitive information in the message that can potentially harm your security. More info can be found in the article: Using credentials for webhooks.

If you suspect you have accidentally publicly shared details such as bot email_tokens and IDs, you can contact support to get your bot email_tokens reset.

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:

[

{msg1},

{msg2},

{msg3}

]

REMEMBER!

Due to the technical limitations of webhook, we do not recommend using more than 8 bot messages in one alert.


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.


Further information

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!

Did this answer your question?