Export to Pine Script
Run the same rules on TradingView — on your chart, in your account.
The Pine export compiles your strategy spec into a complete Pine Script v6 strategy() — deterministically, with no model in the loop. Indicators, entry and exit rules, stops, targets, time exits, and position sizing all translate into their closest Pine equivalents, and anything that cannot be expressed faithfully is flagged instead of silently dropped. The point is portability: the rules you tested here become a file you own and run on tools we do not control.
From the lab to a TradingView chart
Download the script from the Rules tab
In the lab, open the Rules tab and click ↓ Pine Script (.pine). If parts of your strategy need manual attention on TradingView, a note above the rules lists them before you download — the same items appear as// TODOcomments inside the file.Open a chart of one of your symbols
On TradingView, open a chart for a symbol from your spec and set the chart timeframe to match the spec’s timeframe (a daily strategy on a daily chart, a 15m strategy on a 15m chart).Paste into the Pine Editor
Open the Pine Editor panel, replace its contents with the downloaded file, and save.Add to chart
Click Add to chart. Entry and exit markers appear on the chart wherever the rules fired on that symbol’s history.Open the Strategy Tester
The Strategy Tester tab shows TradingView’s own simulation of the script: trade list, equity curve, and summary statistics — computed by TradingView, on TradingView’s data.
A daily golden-cross spec, for example, comes out like this (abbreviated):
//@version=6
// Golden Cross — exported from chat-to-backtest
// Historical/paper simulation for research and education. Not financial advice.
// Past performance does not predict future results.
//
// Backtest results on TradingView will differ from chat-to-backtest —
// different fill models and data.
strategy("Golden Cross", overlay = true, initial_capital = 100000,
default_qty_type = strategy.percent_of_equity, default_qty_value = 20,
pyramiding = 0, process_orders_on_close = false)
// ── Indicators ──
sma_50 = ta.sma(close, 50)
sma_200 = ta.sma(close, 200)
// ── Rules ──
enterLong = ( sma_50 > sma_200 ) and ( sma_50[1] <= sma_200[1] )
exitSignal = sma_50 < sma_200Getting notified when your rules fire
Once the strategy is on your chart, TradingView can alert you when it places a simulated order: create an alert on the strategy (Add alert → select the strategy as the condition) and choose how you want to be notified — app push, email, or webhook. That alert is created in your TradingView account, runs on their servers, and answers to nobody but you.
This is the intended division of labor: Chat·Backtest never pings you about the market. If you want to be told when your own rules fire, you set that up yourself, on your own tools — the export exists so that takes minutes instead of an evening of transcription.
Some traders go further and route TradingView alert webhooks into third-party broker bridges so that alerts place real orders. That is a decision entirely between you, TradingView, and the bridge vendor — we have no part in the chain and no visibility into it. If you choose that route, it is your integration and your responsibility; run it against a paper account until you have watched it behave through enough sessions to trust it.
Why the results will differ
There is also a structural difference for multi-symbol strategies. The spec runs as a portfolio — a shared pool of capital, a position cap, ranking when more setups fire than slots exist. Pine runs on one chart symbol at a time. The per-trade rules translate faithfully, but portfolio-level selection (max_positions, ranking) does not apply on a single chart; the generated header says so, and the practical move is to add the script to each symbol’s chart separately.
What translates, and what becomes a TODO
The translator covers the engine’s rule grammar: moving averages (simple and exponential), RSI, ATR, z-score, standard deviation, rolling highs and lows, lags and lookbacks, percent change, cross-above/cross-below, day-of-week and month conditions, percent and indicator-distance stops, profit targets, and time exits.
Anything outside that boundary is surfaced, never dropped. Each case becomes a // TODO comment in the file carrying the original expression, and the same list is shown in the Rules tab before you download. The common ones:
- Cross-symbol references (a rule that reads SPY’s close from another symbol’s chart) need a
request.security()call you wire up on TradingView — the TODO includes the exact line to use. - Risk-based position sizing has no direct Pine equivalent; the export ships with percent-of-equity sizing and a TODO explaining the difference.
- Entry at the bar’s high or low cannot be reproduced by TradingView’s order model; the export fills at the next bar’s open and says so in the header.
- Unrecognized functions or identifiers are left in place with a TODO naming them, so you can translate by hand rather than trust a guess.