Automated Trading ยป 3Commas



3Commas is one of the most popular platforms for trading cryptocurrencies. It supports dozens of cryptocurrency exchanges and lets you trade on each of them via its Smart Trade interface. It also lets you setup bots that can trade for you 24/7.

3Commas offers bots that have a built in trading strategy (called QFL), however if you wish to trade using a different trading strategy (e.g. the Data Trader - Supertrend strategy), then you will have to tell your bots every time it's time for them to go long or to go short. The way you do this is by linking your TradingView alerts with the bots in 3Commas. When the strategy script signals an entry, an alert gets triggered on TradingView, and a message is sent to 3Commas, which will result in your bot opening a position. When the price reaches your take profit or stop loss targets, then another TradingView alert gets triggered and delivered to 3Commas, resulting in the bot to close its open position.

In the following sections, you will learn how to set up this trading system.

Please note: This below will be just an example for you to get an idea how to link two systems together (TradingView and a 3rd party system). Please don't just blindly take these settings and start trading using real money.

Sign up to 3Commas

If you are not signed up on 3Commas yet, you can use our referral link to receive a 10% discount for the first purchase of your monthly subscription!

If you opt for a paid subscription, 3Commas will let you trade on a Paper Trading account, which is the recommended way of experimenting with new trading strategies.

Create an account on a crypto exchange

To trade on 3Commas you will have to link your cryptocurrency exchange accounts to their platform. One such exchange is Binance (one of the most popular).

Note: Binance is for non-US residents. Use if you live in the US.

For more information on how to connect an exchange to 3Commas, see

Create a Long bot

Navigate to the bot creation page:

Under "Main settings" section give a name to your bot, e.g. "Supertrend - Long", select an exchange you wish to trade on and select the simple bot type:

3Commas Long Bot Main settings

In the "Pairs" section select the market you wish to trade on. Make sure this is the same market you use on TradingView:

3Commas Long Bot Pairs

In the "Strategy" section select "Long" as the strategy. Decide on a base order size - this will be the amount of money (USDT) used for buying the base currency (BTC) each time the bot opens a long position. For start order type you can select either a market order or limit order. Finally select the currency you want the bot to take profit in.


In the "Deal start condition" section select "Trading View custom signal".

Note: There is a separate "Trading View" start condition - make sure you don't choose that one.


In the "Take profit" section set the Target profit (%) to a high number, e.g. 10. The reason for this is that we don't want the bot itself to decide when to take profit, it will be the Supertrend strategy's TradingView alert telling the bot when to take profit. By setting the take profit to 10, it is pretty certain that the bot will never hit that take profit, so the position will remain open until an alert is sent from TradingView.

Warning: If for whatever reason 3Commas doesn't receive the take profit alert from the strategy script, that will result in your 3Commas bot staying in the trade much longer than you would want it to. This may result in great losses for you. Therefore, when you risk your own money, please make sure to set a more sensible take profit percentage. If your strategy configuration never allows more than 5% take profit, there is no reason why you would want to set your 3Commas bot to have a take profit greater than 5%. This way, even if 3Commas misses the take profit alert, there is a chance that the take profit set by 3Commas will be hit at some point.


In the "Stop loss" section enable the stop loss, and set it to a percentage you are comfortable with losing in case the stop loss alert is not delivered. This % will act as a last line defence mechanism should the stop loss alert not be delivered by the strategy script.


In the "Safety orders" section set the "Max safety order count" and the "Max active safety orders count" to 0, the rest you can leave on default. The long bot won't be using DCA, so we don't want it to open safety trades.


Once all settings look correct, click on "Create Bot". Once the bot was created 3Commas will ask you if you want to start the bot. Click on "Start".

3Commas should have taken you to the bot's "Information" page (you can also start the bot from this page):


Scroll down to the bottom of the page to the messages section, and click on the "Message for deal start signal" to copy a "special" message to your clipboard. We will configure the script to send this message to 3Commas whenever it opens a long position.


Now that the bot is running, and we have the start deal message on our clipboard, let's head back to TradingView and set up the alerts.

Configure strategy alerts

Open a chart on TradingView and select BTC/USDT from Binance (symbol: BINANCE:BTCUSDT). Add the Supertrend strategy to the chart if it is not added already. Don't forget to set the desired time frame. (For testing purposes it is recommended that you set the time frame to as low as possible, so that you get your alerts triggered quicker).

Next, open the strategy settings panel. Scroll down to the Alerts section.

First, you will have to enable the Long: Entry alert, and paste the message from your clipboard to the message box:


That is the entry alert taken care of. Whenever the strategy enters into a long position, it will send this to 3Commas, which in turn will make your Long bot to open a long position.

Now go back to 3Commas and click on the "Message to close all deals at Market Price" to copy the message to close a position.


Go back to the strategy settings window, enable Long: Exit alert, and paste the message into the message box:


Create a TradingView Alert

With both the long entry and exit alerts configured for the strategy, the only thing left is to create a TradingView alert, to get those alerts messages delivered to 3Commas.

To create a TradingView Alert, click on the "Alert" button on the top toolbar:


In the Create Alert window make sure to set the following:

  • Condition:
    • Data Trader - Supertrend
    • alert() function calls only
  • Expiration time - set it to a date when you wish the alert to expire. Note: once the alert has expired, no more take profit / stop loss alerts will be sent, meaning that if at the time of expiration you have a deal open, you would have to close the deal yourself manually.
  • Alert Actions
  • Alert name - Give your alert a meaningful name, e.g. Data Trader - Supertrend - 3Commas


Click on Create.

A few seconds later the strategy should show up in the alert sidebar showing as "Active":


Now whenever the strategy enters into or exits from a long position, it will send a message to 3Commas to open and close positions on your behalf.

Example trade

Once the strategy enters into a long position:


It will generate a Long: Entry alert message:


And your bot on 3Commas should show as having an active "deal":


As soon as the take profit or the stop loss is hit by the strategy, it will generate a Long: Exit alert:


Which should result in 3Commas bot close the trade.

Create a Short bot

If you want to trade short positions as well, simply create a Short bot on 3Commas, and copy the short bot's entry / exit messages into the Short: Entry and Short: Exit alert message boxes in the strategy.

Don't forget to recreate the alert if you had created one already when testing the long bot.

Ideally you would only want to have a single alert active that is signalling entries to both the long and short bots on 3Commas. You shouldn't create two separate alerts, otherwise you may end up in a situation when you have both a long and a short trade open at the same time.


Can I specify the size of the position in the alert message?

Unfortunately, no. The position the 3Commas bot will use is hardcoded into the bot settings. There is no way for you to use the position calculated by the strategy script.

If you want a service that accepts a position size via the alert message, you need to look elsewhere (e.g. Alertatron).

Can I specify the price at which to place the take profit / stop loss?

Unfortunately, no. The take profit and stop loss the 3Commas bot will use is hardcoded into the bot settings.

If you want a service that accepts the take profit and stop loss prices via the alert message, you need to look elsewhere (e.g. Alertatron).

Can I 100% trust the alerts will always deliver to 3Commas and my positions will be opened / closed all the time?

No. There may be times when messages won't be delivered for various reasons that are beyond our (and your) control.

For further information please see the "A word of caution" section on the Overview page.

Do I need to leave my computer running for the 3Commas bots to work?

No. Both the TradingView alerts and the 3Commas bot is run in the cloud, so there is no need to keep your computer running for the automation to work.

Having said that, it is a good idea to set up notifications on your phone, and "babysit" the alerts. Whenever you receive an alert try to check on the 3Commas bot and make sure it has acted on the alert message from TradingView.


The strategy script is firing alerts, but my bot on 3Commas doesn't do anything

Check if the bot on 3Commas is started. A bot that is not started will not accept messages. Also make sure the alert is showing as "Active" on TradingView.

Check the Last events section on the 3Commas bot's page:


You may find some error messages there.

Right click on your running alert on TradingView and select "Edit". Make sure the "Webhook URL" is enabled and the address is set to

Delete the alert, open the strategy settings, and ensure the Long: Entry and Long: Exit alert checkboxes are enabled. Double check that the messages you copied over from the 3Commas bot page is correct. Create the alert again.

Further reading