Documentation

Pine Script Import

Import a TradingView Pine Script v5 strategy and run it against your own data, with PSO optimization and walk-forward validation that TradingView doesn't offer.

How it works: You paste Pine Script v5 code. partiqon uses AI (Claude) to convert it into a graph: the same visual block graph you'd build by hand. You see every node, can edit it, and can then backtest or optimise it. The conversion is one-shot; the result is a standard graph, not a "Pine runner".

How to use it

  1. Open the workspace and open or create any strategy.
  2. Click Pine Import in the graph editor toolbar.
  3. Paste your Pine Script v5 strategy code into the text area.
  4. Give it a name, then click Convert to graph.
  5. Review the converted graph, then click Save & open to open it in the editor. Review the blocks. All input() variables become tunable constants automatically.
  6. Run a backtest or PSO optimisation as usual.

What gets converted

Pine Script constructGraph block
ta.ema(src, len)Indicator.EMA
ta.sma(src, len)Indicator.SMA
ta.rsi(src, len)Indicator.RSI
ta.atr(len)Indicator.ATR
ta.macd(...)Indicator.MACD
ta.bb(src, len, mult)Indicator.BollingerBands
ta.stoch(k, d, ...)Indicator.Stochastic
ta.highest(src, len)Indicator.Highest
ta.lowest(src, len)Indicator.Lowest
ta.crossover(a, b)Math.CrossesAbove
ta.crossunder(a, b)Math.CrossesBelow
strategy.entry("Long", strategy.long)Sink.Entry.Long
strategy.entry("Short", strategy.short)Sink.Entry.Short
strategy.close(...)Sink.Exit
input.int / input.floatSource.Constant.Number (tunable)
input.boolSource.Constant.Boolean
and / or / notLogic.And / Or / Not
condition ? a : bLogic.IfThenElse
>, <, >=, <=, ==Compare.GT / LT / GTE / LTE / EQ
+, -, *, /Math.Add / Sub / Mul / Div
close / open / high / lowSource.Bar.Field

Limitations: what doesn't convert

partiqon's graph system covers indicator-based trading logic. Some Pine Script features have no equivalent:

⚠ Always review the imported graph before backtesting. The AI conversion is accurate for well-structured Pine scripts but not guaranteed. Check that all entry/exit conditions connected correctly, especially if your script uses complex nested conditions.

Example: EMA crossover

Here's a simple Pine Script v5 strategy and what it becomes after import:

//@version=5 strategy("EMA Crossover", overlay=true) fastLen = input.int(9, "Fast EMA") slowLen = input.int(21, "Slow EMA") slPips = input.float(20.0, "Stop Loss") tpPips = input.float(40.0, "Take Profit") fastEma = ta.ema(close, fastLen) slowEma = ta.ema(close, slowLen) if ta.crossover(fastEma, slowEma) strategy.entry("Long", strategy.long, stop=close - slPips*0.0001, limit=close + tpPips*0.0001)

After import, the graph contains: two EMA blocks (fastLen and slowLen as tunable constants), a CrossesAbove block, a Mul + Sub for stop distance, Mul + Add for take profit, and an Entry LONG sink. All four input.* variables are marked tunable and ready for PSO optimisation.

Tips for best results

Exporting a graph to Pine Script

The Pine Export button in the toolbar turns the open strategy into a TradingView Pine Script v5 strategy. The script is written to trade the way partiqon's backtest trades the same graph:

What the script cannot reproduce is listed at the top of the file:

When some blocks could not be translated, partiqon says so right after the export.