Join before launch: 2 months of our top plan free, worth $298.2 months of our top plan freeClaim

How to run a Pine Script strategy as a live bot

Pine Script can’t trade on its own. TradingView’s documentation says scripts “cannot directly place orders on exchanges.” To run one live, something outside the script has to turn its signals into orders. There are three ways to do that.

The three routes

Route How it works Good Bad
Alerts and webhooks TradingView sends an alert to a service that places the order Keeps your script as it is More steps that can fail, needs a paid TradingView plan
Rewrite it Port the logic to Python or similar and run it on a server Full control Takes time, and the port can behave differently
Run it in a bot platform The platform reads your Pine Script and places the orders No alert chain You depend on how well it matches Pine

Each step of the webhook route can fail, so log every step and compare with your exchange’s order history.

Check your script first

Repainting. A strategy that repaints looks better on history than it trades live. TradingView’s FAQ explains that historical bars are evaluated once, at the close, so realtime behaviour can differ. Leave calc_on_every_tick off when you backtest, and check how you use process_orders_on_close.

Trailing stops. Built-in trailing stops assume price movement inside historical bars, which can cause repainting. A custom trailing stop that updates at the bar close avoids this.

Chart type. Backtests on Heikin Ashi, Renko and similar charts can be unrealistic, because their prices aren’t real traded prices. Test on standard candles.

Fees and slippage. Set both in the strategy properties, so the backtest counts them.

Order sizes. Exchanges have minimum order sizes and step sizes. A size that works in a backtest can be refused live.

Going live safely

  1. Test the script with costs included.
  2. Run it on virtual money and compare signals bar by bar.
  3. Create an API key with withdrawals off.
  4. Start with a small amount, and watch the first trades.

In Tradenos, you paste your Pine Script and it runs inside the app, with no alert or webhook in between. Tradenos isn’t open yet, so join the waitlist if that’s what you want.

Sources

More guides

Trading crypto can lose you money, including all of it. This isn’t financial advice.

Test your own idea when we open.

2 months of our top plan free, worth $298. No card.

Get 2 months of Operator free

2 months of Operator$298
Third month, with one friend$149
Earlier inviteIncluded
Card neededNone
You pay to join$0