Hi,
here I share a Discord Share Service developed with help AI tools like Perplexity and DeepSeek and that enables sharing charts to a Discord channel or server.
Summary of the Telegram Share Service
The Telegram Share Service is a custom NinjaTrader 8 component that sends text alerts and/or chart screenshots to a specified Telegram chat, group, or channel using your own custom Telegram bot. It is called from indicators or strategies via Share("ServiceName", text, imagePath).
Core Capabilities:
-
Text Delivery: Sends alert text inside a monospace block (
<pre>...</pre>) so that padded columns and tables align perfectly, just like Discord’s code blocks. -
Image Delivery: When an image path is provided, the chart is sent as a photo via Telegram’s
sendPhotoendpoint. The alert text is delivered as the photo’s caption, using the same monospace and bold formatting. -
Length Handling: Text-only messages are truncated at 4096 characters (Telegram’s limit), while photo captions are truncated at 1024 characters (Telegram’s stricter caption limit). Truncation is done safely without cutting off formatting tags.
Configuration Layout:
- Credentials Group: Chat ID, Bot Token, plus NinjaTrader’s built-in Service name and Default fields. Share Service property fields includes help instructions for configuring the service.
Technical Design:
-
Uses Telegram’s HTML
parse_modeinstead of Markdown, because HTML only requires escaping three characters (&,<,>) and avoids the fragile formatting-symbol errors that Markdown causes with arbitrary alert text. -
The bot must have been started at least once in the target chat (private, group, or channel) before the service can post; otherwise, Telegram returns a
chat not founderror.
Enjoy the sharing possibilities provided by NT8.
@ProyectoROI25
