Docs › Setup guides › NinjaTrader setup

NinjaTrader setup

NinjaTrader 8 has no built-in webhook for alerts. A NinjaScript indicator or strategy can send one in C#. Our free HoldAlarmsClient.cs does that on a background thread: point it at your HoldAlarms webhook URL and HoldAlarms forwards each alert to your destinations, with retries.

1. Add the files

  1. Download HoldAlarmsClient.cs and HoldAlarmsNotifier.cs from the ninjatrader folder of our MIT-licensed HoldAlarms snippets repository.
  2. Copy both into Documents\NinjaTrader 8\bin\Custom\Indicators.
  3. Open New → NinjaScript Editor and press F5 to compile.

2. Try the example indicator

Add HoldAlarmsNotifier to a chart and paste your webhook URL into its settings. It sends a test alert when live market data starts, then one alert per closed bar. It skips historical bars, so loading a chart doesn't send old alerts. Results show in the NinjaScript Output window.

3. Send from your own code

// in OnBarUpdate, when your logic decides to alert:
if (State == State.Realtime)
    HoldAlarms.HoldAlarmsClient.AlertAsync(WebhookUrl, "ninjatrader8", Instrument.FullName, "buy", Close[0]);

// or send your own body:
HoldAlarms.HoldAlarmsClient.SendAsync(WebhookUrl, "{\"ticker\":\"ES\",\"action\":\"sell\"}");

AlertAsync sends a small JSON alert with source, symbol, action, price and fired_at (UTC). A body that starts with { or [ goes as application/json, anything else as text/plain. HoldAlarms forwards it unchanged.

4. Timeouts and repeats

The send runs on a background thread, so OnBarUpdate isn't held up. Each try waits at most 3 seconds and it tries twice, only on a network error or a 5xx. It doesn't repeat a 4xx such as 401 (wrong token). If your endpoint needs to spot a repeat, pass your own id.

5. Test it

Add the example indicator to a chart with live or simulated data, then check recent alerts on your dashboard. Your webhook URL is secret: don't share workspace or template files that contain it.

Step-by-step guide with common problems: NinjaTrader 8 webhook alerts.

HoldAlarms is not affiliated with NinjaTrader. NinjaTrader is a trademark of its owner.

← MetaTrader setup · cTrader setup →

HoldAlarms is not affiliated with TradingView. TradingView is a trademark of TradingView, Inc.