Skip to content
Wisang Jati Anggoro
← All work
Alerts & scanners

TradingView Alerts to Telegram

Client profile

Type
Direct client with a Telegram channel
Platforms
TradingView and Telegram

The problem

A TradingView strategy sends its alerts as raw order data, the ticker with its new and its previous position. Pushed into Telegram as it is, that is hard to read, and it does not say whether a closed trade reached its target or its stop.

The wording of the messages had to be easy to change without a developer, and the endpoint had to stay safe even though TradingView webhooks cannot send a secret header.

Path of a TradingView strategy alert to TelegramA TradingView strategy alert reaches the webhook, which can check TradingView's IP addresses and an alert secret. It is classified as an entry, a take-profit or a stop-loss, rendered through that category's template, and sent to one or more Telegram chats. The admin edits the templates and the secret from a Telegram bot menu. The alert is answered within TradingView's 3-second limit and sent from a queue afterwards.

What I built

  • A Flask webhook that sorts each strategy alert into a long or short entry, a take-profit or a stop-loss, by comparing the exit price with the stored entry price
  • Long and short legs tracked separately, so a hedged position on the same symbol keeps both entry prices
  • A message template for each category, edited from a Telegram bot menu with a preview, and checked before it is saved
  • An optional alert secret carried inside the alert body, an optional allowlist of TradingView’s webhook addresses, and bot commands accepted from one admin chat only
  • Alerts answered within TradingView’s 3-second limit, then sent from a queue with retries, to one or more chats
  • An alert that does not fit the six categories, or that arrives malformed, held back instead of being forwarded half-read, with malformed ones flagged to the admin
  • 270 automated tests, a setup guide for Ubuntu with Nginx or a Cloudflare Tunnel, and a separate guide for the bot’s users

Need something similar?

Send your idea, a specification document, a brief video or an unfinished script. I'll review it and send you a quote and timeline, free and with no obligation.

Let's talk