Code Export
Every strategy you build visually can be compiled to source code in four targets. The same compiled logic that drives your backtest is what gets exported, with no divergence between what you test and what you ship.
Export targets
Your node graph is generated into the target you choose, with each output written idiomatically for its platform.
| Target | Typical use |
|---|---|
| Pine Script v5 | TradingView indicators & strategies |
| Python | pandas / research & custom runners |
| JavaScript / TypeScript | Node / web runners |
| JSON | a portable, machine-readable strategy format |
What's in the export
Indicator & signal logic
The full calculation graph (every indicator, condition, and entry/exit rule) translated faithfully to the target language so signals match your backtest.
Deterministic by design
Because export and backtest share the same compiled logic, the same input produces the same signals in either place. No hidden randomness.
Example output
One strategy, idiomatic in each target. A simple EMA-crossover entry, shown as it would generate for Python and Pine Script (illustrative):
import pandas as pd
def signals(df: pd.DataFrame) -> pd.DataFrame:
df["ema_fast"] = df["close"].ewm(span=12, adjust=False).mean()
df["ema_slow"] = df["close"].ewm(span=26, adjust=False).mean()
cross_up = (df["ema_fast"] > df["ema_slow"]) & (
df["ema_fast"].shift(1) <= df["ema_slow"].shift(1)
)
df["entry_long"] = cross_up
return df//@version=5
strategy("EMA Crossover", overlay=true)
emaFast = ta.ema(close, 12)
emaSlow = ta.ema(close, 26)
if ta.crossover(emaFast, emaSlow)
strategy.entry("Long", strategy.long)How to export
- Open your strategy in the visual editor.
- Choose a target language in the export dialog.
- Generate, and the graph is compiled and rendered to source code in your chosen language.
- Copy or download the file and run it on your platform.
Parity & accuracy
Engine ↔ Python parity
Our engine (used by the backtester and chart extraction) and the exported Python stay in lockstep, with parity tests so exported Python behaves like what you tested.
Review before you run
Exported code is yours to read and adapt. Always validate on your platform with your own data and risk settings before any real money.
