# Webhooks

goodcryptoX allows you to automate DEX trading via TradingView webhooks — a powerful mechanism for triggering orders and bot actions directly from your signals.

Unlike some implementations that treat webhooks like a programmable API (where you send parameterized commands like "buy 3 BTC"), goodcryptoX currently supports a trigger-based model. Each webhook simply activates a predefined action on a specific order or bot — no parameters or commands are interpreted.

In the near future, we will launch a new TradingView Strategy bot that supports full strategy instructions via webhooks, including dynamic symbol selection, quantities, order types, and multi-symbol logic — effectively acting as an API layer. Stay tuned

> Webhooks are only accepted from TradingView servers for now — no custom IPs or external sources.\
> If you need to use a custom webhook source, contact us at <support@goodcrypto.app> to request access.

### How webhooks work in goodcryptoX

* Every order or bot **action** has its own dedicated webhook URL
* You must create the order or bot first to get the URL (they will appear in the **Webhooks** section of the order or bot's **Details**)
* Sending **any** webhook payload to that URL will trigger the action

Here is a video overview:

{% embed url="<https://youtu.be/Mx-nD_p2Pgw>" %}

> Webhook URLs are action-specific. You must create one webhook per action, e.g. one for entry, one for take profit, one for stop loss, etc. for every bot or order

### Supported order and bot actions

If you want your order or bot to be **triggered by a webhook**, you must select webhook as the **trigger condition during setup**. This applies to:

* Limit orders trigger
* Trailing order activation (trailing start)
* Take-profit and stop-loss triggers&#x20;
* DCA bot entry condition

> **Cancel** webhook — always available in all orders and bots
>
> **Close position** webhook — always available in DCA bot details

<figure><img src="https://3159525366-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrFKhEXxJL95YqC19XHlF%2Fuploads%2Fl2pfeXIwqa1tpvsFEldb%2Fimage.png?alt=media&#x26;token=99ca6c17-d547-47c7-abaf-1d1e3bb4e03a" alt="" width="375"><figcaption></figcaption></figure>

After creation, you’ll find all available webhook URLs in the **Details** of your order or bot:

<figure><img src="https://3159525366-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrFKhEXxJL95YqC19XHlF%2Fuploads%2FlG04MgjoXROWz32j0tN4%2Fimage.png?alt=media&#x26;token=08009fa1-7757-4495-b60e-1165e12887b3" alt="" width="375"><figcaption></figcaption></figure>

To sum up:

| Action                          | Supported? | Notes                                             |
| ------------------------------- | ---------- | ------------------------------------------------- |
| Cancel order                    | ✅          | Always shown in details                           |
| Trigger Limit order             | ✅          | Must select webhook at setup                      |
| Activate Trailing order         | ✅          | Trailing start = webhook                          |
| Trigger take profit / stop loss | ✅          | Optionally webhook-triggered                      |
| DCA bot - entry                 | ✅          | Entry buy/sell via webhook (must be set at setup) |
| DCA bot - exit                  | ✅          | Close position via webhook (always available)     |

{% hint style="info" %}
**Multiple take-profit targets with webhooks**

If you set up a take-profit group using webhook as the trigger method, they will all share the same webhook URL. Each time the webhook is triggered, the next TP order in the sequence will execute — one by one.
{% endhint %}

### How to set up alerts in TradingView

Once you’ve created your order or bot in goodcryptoX and copied the webhook URL for a specific action, here’s how to link it to your TradingView alerts:

1. Go to your chart in TradingView
2. Create a new alert based on your strategy, indicator, or condition
3. In the **alert settings**, enable the checkbox **“Webhook URL”**
4. Paste in the specific webhook URL from the goodcryptoX **Available webhooks** section
5. Leave the **message field** as-is (any content is fine — goodcryptoX ignores the payload for now)
6. Save the alert

### Repeating strategies (via DCA bot)

A webhook-triggered order (e.g. limit with TP and SL) is a **one-time setup**. Once the order executes and the linked TP or SL fires, the entire trade is complete. If you want this structure to **repeat automatically**, that’s not possible with orders — but it is achievable now using the DCA bot.

We will soon introduce a dedicated TradingView strategy bot to support repeating multi-action trades, but in the meantime, DCA bot provides a flexible way to repeat your webhook-driven strategy.

#### Pure webhook loop

To set up a bot that enters a position on a webhook, exits on a webhook, and then repeats:

1. Set **entry condition** = webhook
2. Set **averaging orders** = 0 (disable averaging)
3. Disable both **take**-**profit** and **stop-loss**
4. Enable **"Repeat on close position"**

<figure><img src="https://3159525366-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrFKhEXxJL95YqC19XHlF%2Fuploads%2FNUBBrWgJqqqvjcnLBw7C%2Fimage.png?alt=media&#x26;token=ced6146d-5d8e-4496-94bc-0cb08cb57282" alt="" width="375"><figcaption></figcaption></figure>

Once the bot is launched, you’ll see the following webhook URLs under the bot's **Details → Webhooks** section:

* **Enter Buy** — opens a Long position
* **Close position** — closes the active position (long or short)
* **Cancel** — stops the bot

**Execution logic**

* When the bot receives **Enter Buy**, it opens a long position.
* The bot will **only respond to the first entry webhook** it receives while idle.
* While a position is open:
  * Any further entry signals are **ignored**
  * The only accepted signals are **close position** or a triggered TP/SL (if configured)
* Once the position is closed (manually, by webhook, or by SL/TP), the bot resets and waits for the next Entry webhook.

This loop continues as long as the bot remains active, allowing you to repeat a complete entry → exit → reset cycle indefinitely.

#### Pure webhook mode vs hybrid setups

The DCA bot supports multiple control layers that can be combined to build flexible strategies:

* **Entry**: via webhook, signal, or instant
* **Exit**: via webhook, or built-in price-based TP/SL
* **Averaging**: optional; can be disabled

You can:

* Run a bot entirely via webhook signals (entry and exit)
* Add price-based TP/SL as fallbacks, even if you use webhook exits
* Add averaging orders for additional protection

This makes it possible to design:

* Fully automated loop strategies (pure webhook)
* Signal-driven bots with manual failovers
* Hybrid setups with multi-layer exits

### Practical webhook strategy examples

#### Example 1: One-off order + multiple take profits (Bollinger Band bounce)

**Goal:** Buy when price breaches lower Bollinger Band, sell progressively as it climbs.

**Setup in goodcryptoX**

* Create a limit order with trigger condition = webhook
* Add three take-profit targets. TP trigger = webhook

<figure><img src="https://3159525366-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrFKhEXxJL95YqC19XHlF%2Fuploads%2Ffg4E339WmltyEDaiNjma%2Fimage.png?alt=media&#x26;token=0ee7cab9-7575-4ac2-89c4-841693b2ba77" alt="" width="375"><figcaption></figcaption></figure>

**Setup in TradingView**

Create four alerts:

1. Price breaches lower band → send to main order's **Trigger** webhook URL
2. Price returns inside band → send to **Take Profit Trigger** webhook URL
3. Price crosses mid-band → send to **Take Profit Trigger** webhook URL
4. Price breaches upper band → send to **Take Profit Trigger** webhook URL

<figure><img src="https://3159525366-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrFKhEXxJL95YqC19XHlF%2Fuploads%2Fc3oNniHr6lmTUwc8qQ7V%2Fimage.png?alt=media&#x26;token=9787c6e6-5744-48cc-8ae1-a891fd775e8e" alt="" width="375"><figcaption></figcaption></figure>

In the **alert settings**, enable the checkbox **“Webhook URL”**

Paste in the specific webhook URL from the goodcryptoX **Available webhooks** section. Leave Message field as is — it is not used.

#### Example 2: Repeating strategy with DCA bot (Golden/Death Cross)

**Goal:** Enter long on Golden Cross, enter short on Death Cross. Exit with a 10% profit or when RSI > 70 and repeat forever.

**Setup in goodcryptoX**

Create DCA bot

* Entry condition = webhook
* Averaging = off (set to 0)
* Take Profit = 10%
* Stop loss = off
* Enable: "Repeat on TP"

**Setup in TradingView**

* Create three alerts on the same chart:
  1. SMA50 crosses above SMA200 → send to **Enter Buy** webhook
  2. SMA50 crosses below SMA200 → send to **Enter Sell** webhook
  3. RSI > 70 → send to **Close position** webhook

### Summary

| Concept            | Description                                                    |
| ------------------ | -------------------------------------------------------------- |
| Trigger model      | Each action has its own webhook URL                            |
| Setup flow         | Create order → copy webhook URL → paste into TradingView alert |
| Repeating strategy | Use DCA bot with repeat enabled                                |
