Introducing the XT Alert Builder Strategy on TradingView
The XT Alert Builder strategy represents a significant leap forward for traders who want to do more with their TradingView strategies.
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 strategy was developed to solve this limitation.
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 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?
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:
Custom Command Building for Alerts:
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:
Trading Hours
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:
These settings include your NT8 specifics for the account, instrument and quantity for the trade.
Trade Management
The option to trigger an ATM strategy template on NinjaTrader is also included, allowing for full automated trading capabilities with trailing stops and auto-breakeven rules.
Stop Loss and Take Profit levels
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 with either tick or percentage-based values.
CrossTrade Advanced Options
Include various Advanced Options like flatten_first, require_market_position, delay_timer, rate_limit, and max_position for unqiue trading scenarios,
Alert Creation Instructions
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}}
Putting It All Together
The XT Alert Builder 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).
Final Thoughts
By implementing a single, robust framework that references external indicators, The XT Alert Builder applies flexible filtering, and outputs richly formatted alerts, it gives traders the best of both worlds.