If you have a strategy or indicator alert in TradingView, you do not need a browser extension or a computer left running to turn it into an automatic order on Binance. When the alert fires, TradingView sends the signal to OptAlgo through a webhook, and OptAlgo opens the order on your connected exchange. This guide covers the setup from start to finish.
What you need
- A free OptAlgo account: open one here.
- A paid TradingView plan for webhook alerts. TradingView offers webhooks only on paid plans.
- A Binance account for live trading. You do not need an exchange connection to start on paper.
1. Connect Binance (for live trading)
OptAlgo connects to Binance through the Binance Link program. In the app you connect in one click through Binance's own consent screen; the key it creates is IP-restricted and cannot withdraw. Your assets stay in your account on the exchange, and OptAlgo only trades. If you want to try on paper first, leave this step for later: paper bots are simulated at real market prices and need no exchange connection.
2. Create a bot in My Bots
For a single-symbol bot you choose its name, the exchange, the market type (Spot or Futures), the symbol, the allocated amount and whether it runs on paper or live. Futures symbols end in .P, for example BTCUSDT.P. If you do not want to set the bot up in advance, create an automatic bot: its first signal sets the exchange, the symbol and the market type by itself.
Every bot has a Strategy Key. The alert message carries this key, and that is how OptAlgo knows which bot a signal belongs to. The key does not expire and stays valid until the bot is deleted; anyone who has the key can send signals to your bot. Do not paste it into public scripts, screenshots or chats.
3. Write the alert message
An example message for a long entry:
{
"strategy_key": "PASTE_YOUR_STRATEGY_KEY",
"exchange": "BINANCE",
"ticker": "{{ticker}}",
"position_side": "LONG",
"action": "BUY",
"leverage": 5
}To close the position:
{
"strategy_key": "PASTE_YOUR_STRATEGY_KEY",
"exchange": "BINANCE",
"ticker": "{{ticker}}",
"position_side": "CLOSE"
}Rules that keep the message from being rejected:
- Paste your bot's real Strategy Key. {{strategy_key}} is not a TradingView variable; it is sent as it is and rejected.
- Send exchange and ticker in every message, exits included. On a single-symbol bot the ticker must be the bot's symbol; on futures charts {{ticker}} arrives with the .P suffix.
- position_side and action are written in upper case (LONG, BUY). TradingView's {{strategy.order.action}} variable produces lower case (buy) and is rejected as an action.
- Futures entries need leverage.
If you use a Pine strategy, the script itself can produce the message: it passes the JSON as alert_message to each strategy.entry and strategy.close call, and you write only {{strategy.order.alert_message}} in the message of a single alert. If you do not want to write any code, add the free OptAlgo Backtest template to your chart and paste your Strategy Key; the alert message is prepared for you.
4. Enter the webhook URL
Create the alert in TradingView and paste the JSON above into the message. In the Notifications tab, turn on Webhook URL and enter this address:
https://api.optalgo.com/signal-listener/signal
In the options, “Once Per Bar Close” is recommended, so the same signal does not arrive twice. Every delivery is processed.
5. Check it
After the alert fires, open the bot's logs in OptAlgo. The webhook returns 204 even when the signal is rejected; the logs are where you see the outcome. A new bot shows as unverified until its first valid signal; that signal verifies the bot and you get a notification. Every filled order and every error also lands in your Telegram.
Paper first, then live
Start the bot on paper and watch a few alerts get handled the way you expect. Paper trades have no stop-loss or take-profit order on the exchange side; they open and close with your signals. When the numbers hold up, you switch the bot to live from My Bots; a bot with an open trade cannot switch between paper and live.
Common problems
- The alert never arrives: check the webhook address. The https://api.optalgo.com/signal address in old docs does not exist; alerts sent there never reach OptAlgo. The right address is the signal-listener one above.
- “Signal symbol does not match strategy symbol”: the single-symbol bot's symbol and the ticker in the message differ. Do not forget the .P suffix on a futures chart.
- “Exchange not found or does not match with strategy”: the exchange in the message is not the bot's exchange, or it was not sent at all.
- The close did not work: if the bot is not verified yet and has no open trade, there is nothing to close and the signal is not applied.
- The same signal arrived twice: set the alert to “Once Per Bar Close”.
If you want to trade many coins with one key, multi-symbol bots support up to 10 open coins on Plus and 20 on Pro. All the alert message examples (partial close, moving the stop, multi-symbol bot) are in the docs. For an overview of the product, see the TradingView bots page.