DEV Community

klein sergej
klein sergej

Posted on

# I Auto-Execute TradingView Alerts on Any Exchange in 5 Lines of Python


TradingView fires an alert. Your strategy says BUY. And then... nothing. You're staring at the screen waiting to click manually.

That's the gap pulse-tradingview fills.

The problem

TradingView has great charting and Pine Script. What it doesn't have is a way to actually execute trades when an alert fires. You can send a webhook — but then you need a server to receive it, parse it, connect to the exchange API, handle auth, sign requests, deal with errors.

Most people either pay for 3Commas ($30-$100/month) or write their own brittle middleware.

There's a third option.

The solution

pip install pulse-tradingview pulse-bybit
pulse-tv init   # creates pulse_tv_config.json
Enter fullscreen mode Exit fullscreen mode

Edit the config:

{
  "bybit": {
    "api_key": "YOUR_KEY",
    "api_secret": "YOUR_SECRET"
  },
  "min_confidence": 0.8,
  "pairs": ["BTC/USDT", "ETH/USDT"]
}
Enter fullscreen mode Exit fullscreen mode

Start the server:

pulse-tv start
Enter fullscreen mode Exit fullscreen mode
pulse-tradingview v0.1.1
Webhook server: http://0.0.0.0:8888/

In TradingView → Alert → Webhook URL:
  http://YOUR_PUBLIC_IP:8888/

Waiting for signals...
Enter fullscreen mode Exit fullscreen mode

Set your TradingView alert webhook URL to your server IP and paste this as the alert message:

{
  "action": "{{strategy.order.action}}",
  "symbol": "{{ticker}}",
  "price": "{{close}}",
  "interval": "{{interval}}",
  "confidence": "0.85"
}
Enter fullscreen mode Exit fullscreen mode

That's it. When the alert fires → trade executes on Bybit.

How it works

pulse-tradingview is part of PULSE Protocol — an open-source semantic messaging standard for AI and trading systems.

The flow:

TradingView Alert (webhook POST)
  → WebhookReceiver (parses JSON)
  → AlertConverter (maps to PULSE message)
  → SignalRouter (applies filters)
  → Exchange Adapter (places order)
Enter fullscreen mode Exit fullscreen mode

Each component is a clean Python class you can use independently.

Switch exchanges in one line

# from pulse_binance import BinanceAdapter as Adapter
# from pulse_okx import OKXAdapter as Adapter
from pulse_bybit import BybitAdapter as Adapter

adapter = Adapter(api_key="...", api_secret="...")
Enter fullscreen mode Exit fullscreen mode

Same alert from TradingView. Different exchange. Zero code changes.

Route to multiple exchanges simultaneously

One TradingView alert → execute on Bybit AND Binance at the same time:

from pulse_tradingview import WebhookReceiver, SignalRouter
from pulse_bybit import BybitAdapter
from pulse_binance import BinanceAdapter

router = SignalRouter()
router.add_adapter(BybitAdapter(api_key="...", api_secret="..."), "Bybit")
router.add_adapter(BinanceAdapter(api_key="...", api_secret="..."), "Binance")

router.add_filter(lambda p: p["confidence"] >= 0.8)

with WebhookReceiver(port=8888, on_signal=router.route):
    input("Running... press Enter to stop")
Enter fullscreen mode Exit fullscreen mode

Pine Script that works out of the box

Two ready-to-use Pine Script strategies in the repo — RSI and MACD. They format the alert message as JSON automatically:

long_msg = '{"action":"buy","symbol":"' + syminfo.ticker +
           '","price":"' + str.tostring(close) +
           '","confidence":"0.85","rsi":"' + str.tostring(rsi) + '"}'

alertcondition(long_signal, title="PULSE Buy Signal", message=long_msg)
Enter fullscreen mode Exit fullscreen mode

Copy it into TradingView, point the alert webhook at your server, done.

Supported exchanges

Exchange Package
Bybit pip install pulse-bybit
Binance pip install pulse-binance
OKX pip install pulse-okx
Kraken pip install pulse-kraken
Freqtrade pip install pulse-freqtrade

vs 3Commas

3Commas pulse-tradingview
Cost $30-100/month Free
Source Closed Open source
Exchanges Limited Any PULSE adapter
Customization UI only Full Python
Multi-exchange Paid plan Built in

Install

pip install pulse-tradingview

# With your exchange:
pip install pulse-tradingview pulse-bybit
Enter fullscreen mode Exit fullscreen mode

Top comments (0)