---
description: Learn how to build CrossTrade compatible alerts from any indicator
---

# XT Alert Builder

When working with TradingView’s native strategies, users often encounter a major limitation: the inability to differentiate multiple alert types as easily as they can with indicators. Unlike indicators, strategies don’t naturally support multiple distinct alerts, making it difficult to send different alert messages for separate trade events (e.g., one for a buy, another for a sell, and yet another for flat or close conditions).

The [XT Alert Builder](https://www.tradingview.com/script/pKTNcaXf-XT-Alert-Builder-CrossTrade/?ref=crosstrade.io/blog) strategy was developed to solve this limitation.

{% embed url="https://www.youtube.com/watch?v=OKQ-tGREaK8" %}

This enhanced tool allows traders to better manage their alerts and seamlessly connect with NinjaTrader by generating CrossTrade compatible alerts using the \{{strategy.order.alert\_message\}} variable.

### **Limitations of TradingView Strategy alerts** <a href="#limitations-of-tradingview-strategy-alerts" id="limitations-of-tradingview-strategy-alerts"></a>

**A standard TradingView strategy can:**

* Place trades (entries, exits, etc.)
* Backtest performance on historical data
* Send a single alert, which must capture all conditions

**What it cannot easily do, by default, is:**

* Generate multiple, individually selectable alerts (as `alertcondition()` does in indicators)
* Clearly distinguish between different signal types (buy, sell, close) within the default alert framework
* Create a variety of unique alerts without resorting to intricate message formatting or using an external indicator script

With the XT Alert Builder Strategy, these shortcomings are addressed by allowing users the ability to source signals from other indicators and package CrossTrade compatible alerts into the strategy's order variable. Let's dive deeper and expand on this functionality...

### **How Does the XT Alert Builder Strategy Work?** <a href="#how-does-the-xt-alert-builder-strategy-work" id="how-does-the-xt-alert-builder-strategy-work"></a>

At its core, the XT Alert Builder Strategy is an attempt to combine the best of both worlds with the flexibility of indicator alerts and the convenience of the strategy.order.alert\_message variable. This is done by providing inputs sources for Buy Signals and Sell Signals, as well as the accompanying exit signals for both. This structure allows full ultimate customization of both entries and exits with added checkboxes to make the strategy unidirectional if you need.\
\
The first step is to simply add your indicators to the Superchart, and the Alert Builder will reference them inside of the source input:

<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2FnGwNwbIJKjJQYHOK3t4H%2Fimage-1.png?alt=media&#x26;token=4ba01933-639e-4434-97e1-5fca49c4baf6" alt=""><figcaption></figcaption></figure>

#### **Custom Command Building for Alerts:** <a href="#custom-command-building-for-alerts" id="custom-command-building-for-alerts"></a>

When a buy or sell signal triggers, the strategy constructs a detailed XT Compatible command string encoded in the alert\_message.\
\
This message includes instructions like command=PLACE;\
account=...;instrument=...;action=BUY; or action=SELL;, along with optional fields for ATM strategies, stop losses, take profits, and additional parameters.\
\
The inputs panel includes all of the necessary components for full CrossTrade compatibility:



<figure><img src="https://993090024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI6t5LesvaGZE6r1KML4v%2Fuploads%2Fkxt8raZFdS8FlPnAnEvY%2Finput-options-for-xt-alert-builder-2.png?alt=media&#x26;token=6cd60d03-4e9f-4f33-a2c7-fe97007719f6" alt=""><figcaption></figcaption></figure>

#### Trading Hours <a href="#trading-hours" id="trading-hours"></a>

Users can specify a trading session or time window to ensure signals only occur during desired hours. If you select the Session End option for the Exit Signal Type input, the strategy will send the Close Position command at the ending time you define in the Trading Hours.

#### NinjaTrader Settings: <a href="#ninjatrader-settings" id="ninjatrader-settings"></a>

These settings include your NT8 specifics for the account, instrument and quantity for the trade.

#### Trade Management <a href="#trade-management" id="trade-management"></a>

The option to trigger an [ATM strategy template](https://docs.crosstrade.io/ninjatrader/atm-strategies?ref=crosstrade.io/blog) on NinjaTrader is also included, allowing for full automated trading capabilities with trailing stops and auto-breakeven rules.

💡The quantity and ATM strategy name must be an exact match.

#### Stop Loss and Take Profit levels <a href="#stop-loss-and-take-profit-levels" id="stop-loss-and-take-profit-levels"></a>

In addition to the ability to include and utilize an ATM template, you also have the ability to set individual [stop\_loss and take\_profit levels](https://docs.crosstrade.io/webhooks/advanced-options/percentage-and-tick-prices?ref=crosstrade.io/blog) with either tick or percentage-based values.

💡Select only one management option: ATM template or take\_profit and stop\_loss levels.

#### CrossTrade Advanced Options <a href="#crosstrade-advanced-options" id="crosstrade-advanced-options"></a>

Include various [Advanced Options](https://docs.crosstrade.io/webhooks/advanced-options?ref=crosstrade.io/blog) like flatten\_first, require\_market\_position, delay\_timer, rate\_limit, and max\_position for unqiue trading scenarios,

### **Alert Creation Instructions** <a href="#alert-creation-instructions" id="alert-creation-instructions"></a>

In the Alert Message window, you will simply add your CrossTrade secret key and the dynamic strategy variable \{{strategy.order.alert\_message\}}\
\
**For example:**\
Key=your-secret-key;\
\{{strategy.order.alert\_message\}}

<figure><img src="https://crosstrade.io/blog/content/images/2024/12/example-alert-builder-alert.png" alt="example-tradingview-webhook-alert" height="589" width="482"><figcaption><p>Example TradingView Alert</p></figcaption></figure>

### **Putting It All Together** <a href="#putting-it-all-together" id="putting-it-all-together"></a>

The [XT Alert Builder](https://www.tradingview.com/script/pKTNcaXf-XT-Alert-Builder-CrossTrade/?ref=crosstrade.io/blog) strategy represents a significant leap forward for traders who want to do more with their TradingView strategies. By referencing external indicators it overcomes the default limitations imposed by Pine Script’s strategy alerts. Users can now:

* Define clear, condition-based entries and exits.
* Maintain compatibility with advanced order management features (such as ATM strategies on NinjaTrader).
