← All platforms
P TradingView (Pine) — full setup
A Pine strategy you add to a TradingView chart. It shows the backtest and fires alerts on the same signals the bot uses. Follow every step — the last part (routing alerts to your exchange) is what makes it actually trade.
ℹ️
Important — Pine can't place orders by itself. On TradingView the script only draws signals and sends
alerts. To turn those alerts into real trades you connect a webhook bridge (a small service that hears the
alert and places the order on your exchange). That last part is set up below.
1 · Add the script to a chart
- From your Stragenius dashboard, download
stragenius_pine_<SYMBOL>.pineand copy its contents. - On TradingView, open a chart for your symbol, then open Pine Editor (bottom of the screen).
- Delete whatever's in the editor, paste the script, and click Add to chart.
- You'll see the strategy's backtest under the chart (Strategy Tester tab) and green/red regime shading on the chart.
2 · Which TradingView plan you need
- Auto-trading (webhook): needs a paid plan — TradingView Essential/Plus (Pro) or higher. Webhook alerts are not on the free plan.
- Free plan: you can still get email alerts when a signal fires, and place the trade by hand (or use a bridge that reads email). Fine for testing; slower than webhooks.
3 · Pick a webhook bridge & connect your exchange
The bridge is the service that turns an alert into a real order. It logs into your exchange with your API key (which you give to the bridge, not to us). Popular choices:
- OctoBot — open-source, self-host or cloud.
- TradersPost — hosted, no-code, works with many brokers/exchanges.
- Create an account on the bridge and connect your exchange (e.g. Binance) by adding your exchange API key there. Lock that key to the bridge's IP and leave withdrawals OFF.
- The bridge gives you a webhook URL — copy it, you'll paste it into the alert next.
4 · Create the alert with the webhook
- On the chart, click Alert (the clock ⏰ icon) → Create Alert.
- Condition: choose your Stragenius strategy → "Order fills only". The script sends a message on every entry and every exit (take-profit or stop-loss).
- In the Message box, delete the default text and paste exactly:
TradingView replaces it with the script's own JSON:{{strategy.order.alert_message}}
This is TradersPost's format. If your bridge expects different fields, map them in the bridge (or ask us).{"ticker":"BTCUSDT","action":"buy","takeProfit":{"percent":4.2},"stopLoss":{"percent":2.1}} {"ticker":"BTCUSDT","action":"exit"} - The message doesn't carry a position size: set it in the bridge. Use your margin per trade × leverage (e.g. $100 at 2x = $200 position) so it matches the script you generated.
- In the Notifications tab, tick Webhook URL and paste the bridge's URL from step 3.
- Click Create. Now when the strategy enters or exits, TradingView calls the webhook and the bridge places the order on your exchange.
5 · Test on paper first
- Both OctoBot and TradersPost offer a paper-trading mode — connect that first and confirm an alert turns into a (fake) order before using real funds.
- The buy message carries the take-profit / stop-loss as percentages, so a bridge that supports them can place the protection on the exchange right away. The exit message closes the position when TradingView's take-profit / stop-loss is hit. Check in paper mode that both arrive.
6 · Keep your script private
Unlike the other platforms, Pine runs as readable source on TradingView. To stop others copying your strategy, publish it as an invite-only script and share access only with accounts you choose — never paste it into public scripts or chats.
Common problems
- No "Webhook URL" option → your TradingView plan is free. Upgrade to Pro, or use email alerts + a manual/email bridge.
- Alert fires but no trade → the webhook message doesn't match what your bridge expects. Copy the bridge's exact template into the alert message box.
- Bridge can't trade → the exchange API key you gave the bridge is missing Futures permission or is IP-locked to the wrong address. Fix it in the bridge's exchange settings.
- Backtest looks different from the bot → TradingView backtests on the chart's timeframe; keep the chart on 1-minute to match the bot's logic.
- Backtest covers only a few days or weeks → TradingView limits 1-minute history by plan, so the Strategy Tester can't show the 2-year simulation from Stragenius. Compare trades over the same short period instead.