# TradingView Alerts

## Creating TradingView Alerts with Webhooks

To set up an alert, you can utilize various trigger conditions and decide whether the alert should fire once or repeatedly until you disable it. When sending alerts to CrossTrade its important to remember that you are only including the specific instructions needed to communicate with NinjaTrader. The notifications for these alerts can be received via pop-ups, emails, and even push notifications if you have the TradingView mobile app installed.

{% hint style="info" %}
TradingView alerts are held on their servers and will continue to operate even if you are not logged in.&#x20;
{% endhint %}

### Step 1 - Open Alert Window

Inside your Supercharts, click to open an Alert window from the top or right navigation clock button.

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2F59U1kOBS64j5Ng31ekbC%2Fcreate-alert.png?alt=media&#x26;token=7d3ccd12-26c7-4f7e-93e4-4fd609dc4d16" alt=""><figcaption></figcaption></figure>

### Step 2 - Determine your Alert Conditions

To set up an alert, you can utilize various trigger conditions and decide whether the alert should fire once or repeatedly until you disable it. You can customize the Expiration date of the alert and provide a name to keep your alerts organized.&#x20;

{% hint style="info" %}
If you intend to automate from an Indicator or Strategy, you will link your alert to the trigger Condition from that indicator or strategy.&#x20;
{% endhint %}

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FLk18ZeD4H5bkPbrBXiNI%2Falert-condition.png?alt=media&#x26;token=533ae032-b714-4a9e-97ce-0e86ee2c2897" alt=""><figcaption></figcaption></figure>

If your indicator has specific buy and sell conditions, you will see those in the drop down like this standard RSI indicator offers, *Regular Bullish Divergence* and *Regular Bearish Divergence* signals.&#x20;

{% hint style="info" %}
If your indicator does not have a condition you can use to reliably trigger the alert, its incompatible.&#x20;
{% endhint %}

### Step 3 - Provide payload information

In the message field you will supply the payload information you want to send to CrossTrade for relay to NinjaTrader. You can customize this however you want based on the methods NinjaTrader will accept.&#x20;

{% hint style="warning" %}
Remove any default text that may be in that message window when you first load your Indicator or Strategy. You only want to provide the CrossTrade payload. \
\
**For example:** Bot V3 (, , , , , , , , , , , , , , , , hlc3, 5, 2, 2.8, 3, 3, 5, 5, 5, 5, NORMAL, 0.75, 0.75, 25, 3, 2, NORMAL, 3, 3, 4, 4, 9, 5, 1, 1.2, 59, 43, 1.55, 23, 2.4, 6.2, CLASSIC, 9, 19, 0.7, 0.25, 0.6, 5, 19, MAC-Z, 6, 67, 25, 17, 2, 0.6, 61, 80, 20, 80, 20, 50, 14, 30, 15, 30, 0.75, 10,000, Small): order {{strategy.order.action}} @ {{strategy.order.contracts}} filled on {{ticker}}. New strategy position is {{strategy.position\_size}}\
\
**All of that needs to be removed.**&#x20;
{% endhint %}

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FTD8NKGHwr04R0yyJZjVz%2Fmessage-payload.png?alt=media&#x26;token=3e39bd6c-6e6c-489c-a004-e8f0cf8df30b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
ONLY CrossTrade compatible information can be inside the message window. Any non-compatible text will cause the alert to fail.&#x20;
{% endhint %}

### Basic alert for <mark style="color:blue;">Indicator</mark> entries

In this example, we are using a basic PLACE command for a Buy order.&#x20;

> <mark style="color:blue;">key=your-secret-key;</mark>
>
> <mark style="color:blue;">**command=place;**</mark>&#x20;
>
> <mark style="color:blue;">account=sim101;</mark>&#x20;
>
> <mark style="color:blue;">instrument=ES1!;</mark>&#x20;
>
> <mark style="color:blue;">**action=buy;**</mark>&#x20;
>
> <mark style="color:blue;">qty=1;</mark>&#x20;
>
> <mark style="color:blue;">order\_type=market;</mark>&#x20;
>
> <mark style="color:blue;">tif=day;</mark>
>
> <mark style="color:blue;">flatten\_first=true;</mark>

### Basic alert for <mark style="color:blue;">strategy</mark> entries

In this example, we are using the strategy variables to supply the Action and the Qty to your alert dynamically, based on the settings of the strategy.&#x20;

> <mark style="color:blue;">key=your-secret-key;</mark>
>
> &#x20;<mark style="color:blue;">command=place;</mark>&#x20;
>
> <mark style="color:blue;">account=sim101;</mark>&#x20;
>
> <mark style="color:blue;">instrument=ES1!;</mark>&#x20;
>
> <mark style="color:blue;">**action={{strategy.order.action}};**</mark>&#x20;
>
> <mark style="color:blue;">**qty={{strategy.order.contracts}};**</mark>&#x20;
>
> <mark style="color:blue;">order\_type=market;</mark>&#x20;
>
> <mark style="color:blue;">tif=day;</mark>&#x20;

{% hint style="success" %}
There are many different command types for various automation scenarios. You will find more examples in the [**Commands**](https://docs.crosstrade.io/webhooks/commands) and [**Advanced Options**](https://docs.crosstrade.io/webhooks/advanced-options) sections of the docs as well as in the Command Examples section of your Webhooks dashboard.&#x20;
{% endhint %}

### Step 4 - Add Webhook URL

From the **Notifications tab** of the alert window, you will need to provide your specific CrossTrade webhook URL. The URL can be found on your [My Account](https://crosstrade.io/user/my-account) page or on the CrossTrade web Dashboard below the Webhook Trader.&#x20;

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FVvw12ENKHPk5DOC47sii%2Fwebhook-url.png?alt=media&#x26;token=b9fb5509-fba5-47a5-b04d-5a5e84bcbf76" alt=""><figcaption></figcaption></figure>

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FA0LmsIOAL400ya2Ybd3h%2Fadd-webhook-url.png?alt=media&#x26;token=a73eea4f-4d11-46db-af3a-d59e26a2a5f7" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}

#### Webhooks require 2FA to be enabled on your TradingView account. If you have not used webhooks before, you will see this prompt

<img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FxPVitvUFCIPn7F4T9gst%2Fimage%20(4).webp?alt=media&#x26;token=514dc1de-303e-40da-b8a7-ceb34fe5e55a" alt="" data-size="original">\
\
Once enabled, you can add the webhook URL into the field and save the alert
{% endhint %}

### Step 5 - Managing Alerts

Managing alerts is straightforward; you can edit, clone, or delete them from the alert manager, and even adjust alert conditions directly on the chart for easy visualization. Alerts that have been triggered are logged, and you can access and review this log to track past market events and alert responses. On the right hand side of the chart, click the clock icon.

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FtgtbEW3FaDQlSoe1hTZg%2Ffirst-alert.png?alt=media&#x26;token=fcbea610-68cf-4420-8b74-ce1cfe8daabd" alt=""><figcaption></figcaption></figure>

Once you start sending alerts from TradingView to CrossTrade, you can review your recent alert history on the[ CrossTrade Alert History page](https://crosstrade.io/user/alert-history) in your account as well as on the XT Add-on.

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FdsDhiCW2kDjuXgHPLZea%2Fadd-on.png?alt=media&#x26;token=f1b71cda-99be-4f81-98ac-fe94c0e59ae3" alt=""><figcaption></figcaption></figure>
