# 3Commas

### Step 1

First, you need to register for  [3Commas](https://3commas.io/?c=TRADESMART%20), you can use the free plan if you only need one bot running.&#x20;

### Step 2

Next, log in and click on the Dashboard.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FKJQkNsHanhMeW5Sjyg2g%2FByBitDashboardREDLINED.png?alt=media&#x26;token=ef074946-966f-4b22-9d09-0109cd30327c" alt=""><figcaption></figcaption></figure>

### Step 3

Open [ByBit](https://www.bybit.com/sign-up?affiliate_id=30592\&group_id=0\&group_type=1) on a new page and log in. For this tutorial, we are going to use [ByBit](https://www.bybit.com/sign-up?affiliate_id=30592\&group_id=0\&group_type=1), but you can check the supported exchanges [here.](https://3commas.io/exchanges)

### Step 4

Next, click on the profile picture in the top right corner of the page and choose the API tab.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2F4o0AbySjSS0s7uN9xScr%2FBybitMainTopRightRED.png?alt=media&#x26;token=578f79d1-669c-4991-b3cc-c1f73a34d62f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FfIhV7HDS73gtcnVucfbF%2FBybitRightPanelAPIRED.png?alt=media&#x26;token=2a718ed0-93f6-4b7f-bab1-a751c125a0b1" alt=""><figcaption></figcaption></figure>

### Step 5

Click the "Create New Key" button.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FAuAaeOJXTp5qam7r1JPO%2FCreateNewAPIKEYRED.png?alt=media&#x26;token=36ab73bc-e42d-4eba-b105-6daa13b9903c" alt=""><figcaption></figcaption></figure>

### Step 6

You need to set up 2-factor authentication for the following step, and then copy the settings you see in the image below. These three permissions must be allowed to get all the functionalities that 3Commas has.&#x20;

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FyhmzQU7j1eScFa29OUmu%2FBybitCreateNewKey.png?alt=media&#x26;token=a5e95052-0241-436d-a26e-03dc167e9c5a" alt=""><figcaption></figcaption></figure>

Then click the "Submit" button, do the 2-factor authentication, and you can get the API key and secret.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FtafuMuTPVH02wltYCj4g%2FByBitAPIKEYSRED.png?alt=media&#x26;token=6677d7fe-7d3d-45f9-801b-cc3970cf7390" alt=""><figcaption></figcaption></figure>

### Step 7

Now, you can go back to 3Commas, click on "My Portfolio".

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FZXnDbfvXTaXPqaOJRrrI%2FClickMyPortfolio.png?alt=media&#x26;token=8a284b0c-85f8-45d0-96d2-f4afd8148a87" alt=""><figcaption></figcaption></figure>

Click "Connect Account"

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2F5amH2NmubN7bwjkW0hfG%2FClickConnectAccount.png?alt=media&#x26;token=d836ad89-409e-4152-8f65-ee74fc160da1" alt=""><figcaption></figcaption></figure>

Click "Exchanges"

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FLDIo8pO2Ekb7tM9u6xKD%2FselectExchanges.png?alt=media&#x26;token=ce15e84a-cb84-414c-9a71-f0b3446f7894" alt=""><figcaption></figcaption></figure>

Choose your preferred exchange, in this case, we will choose ByBit.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2F8miXg5vUFSG6KE9bgQOI%2FclickExchangeByBit.png?alt=media&#x26;token=08797897-69fb-44e6-8b03-62be6593dec3" alt=""><figcaption></figcaption></figure>

You can then copy the API key and secret from step 6.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FY92rll2sC1zJXbOvOXRn%2FfillInApiKEyAndSecret.png?alt=media&#x26;token=f79c58b0-ad7e-4f9b-9903-31a17cbe52b6" alt=""><figcaption></figcaption></figure>

Then select the exchange types you want to use.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FA8JTvcB1hFJmWF651mks%2Fexchnagetypes.png?alt=media&#x26;token=fa548662-0671-4651-98ab-e8e47956826b" alt=""><figcaption></figcaption></figure>

### Step 8

Click on "DCA Bot"

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2Fdd3LVRaPWpmp9Ox88pwb%2FClickdcaBot.png?alt=media&#x26;token=6569c2e4-d8ae-435a-bbff-8b3b5e8f5dd8" alt=""><figcaption></figcaption></figure>

Click "Create DCA Bot" and choose "Advanced".

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FTDqzRFncuUf62uB2SVDf%2FclickCreateDCABot.png?alt=media&#x26;token=b683e5a5-d6e0-4c6a-9d03-2284fe0d577a" alt=""><figcaption></figcaption></figure>

Set the following settings:

* **Name**: give a name to the bot
* **Exchange**: add the preferred exchange that was set in step 7
* **Pairs**: choose the preferred trading pair
* **Strategy**: Use Long or Short (3Commas can't do long and short at the same time), the other setting are good as default
* **Deal Start Condition**: Trading View Custom signal

{% hint style="info" %}
The other settings should be turned off, as they are managed by the Tradingview Script. Copy those from the images below.
{% endhint %}

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FheIhYBWxdoA4Wa3ByG8O%2FSettings1.png?alt=media&#x26;token=0de8c439-96dc-4767-92aa-cf15e531fee3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FxdSi0ccFbz72hTw0I6Su%2Fsettings2.png?alt=media&#x26;token=0e13fda1-54ec-4d53-ba02-6c09edcbde05" alt=""><figcaption></figcaption></figure>

Submit the settings, and you should see the following image.\
Find the **"Message for deal start signal"** and **"Message to close order at Market price."** \
You will need these to connect to Tradingview.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2F2fFu1QoAQjPKRnyIjgU2%2FcopyBybitKey.png?alt=media&#x26;token=f0d46e51-30b4-4fcd-8f04-ee364fdf2bda" alt=""><figcaption></figcaption></figure>

### Step 9

Open Tradingview in a new tab, set the trading pair and timeframe, and add one of our PREMIUM scripts to the chart. Open the script settings, then scroll down to the Automation Part.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FcZDxr8Usy4meqeuivTPB%2Fenter3CommasShits.png?alt=media&#x26;token=63b188ee-6aac-441a-b684-8df4b872d12a" alt=""><figcaption></figcaption></figure>

If you go Long fill the **Enter Long Alert** with **Message for deal start signal** and **Exit Long Alert** with **Message to close order at Market price.**

If you go Short fill the **Enter Short Alert** with **Message for deal start signal** and **Exit Short Alert** with **Message to close order at Market price.**

{% hint style="info" %}
Don't forget to set the strategy settings to Allow Long Entries or Allow Short Entries.
{% endhint %}

Click "OK" to finalize the settings.

### Step 10

Click on the "Alerts" tab in the top right corner.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FE1IdLBYEduGKpquPxYW0%2FclickAlertsButton.png?alt=media&#x26;token=fd4918ae-817c-4ae7-bbe5-75892bd911e0" alt=""><figcaption></figcaption></figure>

Click on "Alerts Plus" button.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FgQyYiDtNXq0CTzCHr0sM%2FclickAlertPlusButton.png?alt=media&#x26;token=202edd21-35ca-4aa3-93f0-0c753dbbf134" alt=""><figcaption></figcaption></figure>

The conditions should be set to your chosen strategy (in this case, it is our Triple EMA strategy).

Set an expiration date for how long you want to use the strategy.

Allow Show Pop-up

Allow Webhook URL, to the textbox, insert the following URL:

<https://app.3commas.io/trade_signal/trading_view>

{% hint style="info" %}
With Tradingview free version you can't allow Webhook URL-s
{% endhint %}

For the message part add the following line:

```
{{strategy.order.comment}}
```

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2F8RIvg2rGJRWjQVvMPjN2%2FswitchToTheConditions.png?alt=media&#x26;token=80f2a358-b224-440f-b0c4-936ba9bbe940" alt=""><figcaption></figcaption></figure>

Click "Create" button, and after a few seconds, you should see the alert created.

<figure><img src="https://381029026-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJJzXIMzMJVgtuzlErO6%2Fuploads%2FLCj4lmaN155hVVgTCBz6%2FFinal.png?alt=media&#x26;token=9e298eea-5f1d-491d-9d26-748ce594af6e" alt=""><figcaption></figcaption></figure>

**Congratulations! You now have a running script!**
