NexusFi: Find Your Edge


Home Menu

 



Categories Help    






 
Connection and Order Watchdog
Connection Watchdog V1

I created this watchdog to let me know if NT8 becomes disconnected or an order isn't accepted and traded straight away. I set it up for IBKR and Kinetick, so it may need to be modified (ChatGPT) for other alternatives.

The Connection & Order Watchdog performs these primary tasks:
- Monitors connection health: Tracks order and price-feed status for all configured NinjaTrader connections, including IBKR and Kinetick.
- Allows self-recovery: Waits for the configurable response delay before warning or reconnecting, avoiding action during short interruptions.
- Performs safe reconnection: Uses progressive retry delays and reconnects only when the previous connection object has disappeared. It never forcibly disconnects an existing session.
- Protects against duplicate logins: Detects Kinetick second-login conflicts, suspends automatic reconnect attempts and allows the lockout to be manually reset.
- Monitors delayed orders: Warns when orders remain Submitted without broker acceptance.
- Monitors idle stock/ETF orders: Continues watching relevant Accepted, Suspended, AcceptedByRisk and working market orders that may be held until regular trading hours. Using IBKR order management standards - will need reprogramming for other brokers.
- Sends configurable notifications: Supports Telegram, NinjaTrader Share Service email, sound alerts, popup messages and the NinjaTrader Alerts Log.
- Reports connection status: Displays Kinetick connection state, startup configuration, last disconnection, scheduled retry and latest error.
- Prevents duplicate menu instances: Maintains one process-wide Connection Watchdog entry even after NinjaScript recompilation or workspace changes.
- Preserves settings securely: Saves notification and timing selections; Telegram credentials are protected through Windows Credential Manager.
The watchdog is deliberately conservative: it does not cancel, modify, resubmit or flatten orders, and it does not forcibly disconnect active connections.

To install it you import it as a Plugin and restart NT8.

To connect Telegram you'll need to do the following...

Telegram Connection Manual
Connection & Order Watchdog for NinjaTrader 8
Requirements

You need:
- An existing Telegram user account.
- The Connection & Order Watchdog installed in NinjaTrader.
- Internet access from the NinjaTrader computer to api.telegram.org.
- A Telegram bot token and numeric chat ID.
You do not need a separate Telegram user account, Telegram password, phone number or continuously running bot application.

1. Create the Telegram bot
1. Open Telegram on your phone or computer.
2. Search for @BotFather and make sure it is the official verified BotFather.
3. Open the conversation and select Start.
4. Send:
/newbot
5. Enter a display name, for example:
NinjaTrader Watchdog
6. Enter a unique bot username. It must end in bot, for example:
JasonNT8WatchdogBot
7. BotFather will provide a bot token resembling:
1234567890:AAExampleTokenCharacters
8. Copy the complete token and store it securely.
Telegram officially documents the /newbot process and requires bot usernames to end in bot. Treat the token like a password because anyone possessing it can control the bot. Telegram BotFather instructions

2. Start a conversation with the bot
1. Select the link supplied by BotFather or search for the new bot’s username.
2. Open the bot.
3. Press Start.
4. Send it a message such as:
NT8 test
The bot cannot send you a private message until you have contacted it first. Telegram bot tutorial

3. Obtain your numeric chat ID
1. After sending the bot a message, open a private browser window.
2. Enter the following address, replacing <BOT_TOKEN> with the complete token:
https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
3. Telegram will return JSON-formatted information.
4. Find a section similar to:
"chat": {
"id": 123456789,
"first_name": "Jason",
"type": "private"
}
5. Copy the number following "id".
For a private conversation, the chat ID is normally a positive number. Group and supergroup IDs are commonly negative numbers. Copy the minus sign when present. Telegram defines this chat.id value as the unique destination identifier. Telegram Bot API

If the result is empty:
- Confirm that you pressed Start.
- Send the bot another message.
- Refresh the getUpdates address.
- Verify that the token was copied correctly.
Close the private browser window afterward so the token is not left in normal browser history.
4. Enter the details in NinjaTrader
1. Start NinjaTrader 8.
2. Open the Control Center.
3. Select:
Tools → Connection & Order Watchdog → Configure Telegram…
4. Enter the numeric Telegram chat ID.
5. Paste the complete Telegram bot token.
6. Select:
Enable Telegram notifications after saving
7. Press Save.
The watchdog stores the bot token in Windows Credential Manager. It does not embed the token in the NinjaScript source. The chat ID is stored in:

Documents\NinjaTrader 8\ConnectionWatchdog.settings
5. Test the connection
1. Open:
Tools → Connection & Order Watchdog
2. Confirm Telegram notifications is checked.
3. Select Send test Telegram.
4. Check Telegram for a message from the watchdog bot.
5. NinjaTrader should report that the Telegram test was sent successfully.
The watchdog must also be Enabled for automatic connection and order warnings.
6. Optional group-chat setup
To send warnings to a Telegram group:
1. Create or open the desired group.
2. Add the watchdog bot to the group.
3. Give it permission to send messages.
4. Send a command mentioning the bot, such as:
/start@JasonNT8WatchdogBot
5. Open the bot’s getUpdates address again.
6. Locate the group’s "chat":{"id":...} value.
7. Copy the complete negative chat ID into the watchdog configuration.
8. Send another test from NinjaTrader.
Troubleshooting
| Error | Likely cause | Resolution |
|---|---|---|
| Unauthorized or error 401 | Incorrect or revoked token | Obtain the current token from BotFather |
| Chat not found or error 400 | Incorrect chat ID or bot was never started | Message the bot, then retrieve the chat ID again |
| Forbidden or error 403 | Bot was blocked or removed from the group | Unblock or re-add the bot |
| Test works but automatic alerts do not | Telegram notifications or watchdog disabled | Check both settings in the Tools menu |
| `getUpdates` returns no messages | The bot has not received a new message | Send another message and refresh |
| `getUpdates` reports a webhook conflict | Bot is already used by another application | Create a dedicated watchdog bot rather than disrupting the other application |


Security and removal
- Never send the bot token through email, screenshots or public messages.
- If the token is exposed, use BotFather to revoke it and generate a replacement.
- Re-enter the replacement token in NinjaTrader.
- To erase the locally stored token and chat ID, select:
Tools → Connection & Order Watchdog → Remove Telegram credentials
The watchdog uses Telegram only to send notifications. It does not receive Telegram trading commands and cannot place, cancel or modify orders through Telegram.


Category NinjaTrader 8 Indicators and More 
 
Suggest other entries I might like
Details: Connection and Order Watchdog
Category: NinjaTrader 8 Indicators and More 


November 10th, 2026
Size: 17.91 KB
Downloaded: 2 times

 




© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top