Exciting Update: Version 1.0.1 is now available, introducing the high-performance BacktestX Custom Script Editor. Read more
Version: 1.0.1

Pine Script Transpiler

BacktestX includes a powerful built-in code transpiler that allows you to copy-paste standard TradingView Pine Script (v4 or v5) and automatically convert it into native JavaScript.

How it works

When you paste Pine Script into the editor and click "Convert", the transpiler parses your code and wraps it in a compatibility layer.

  • Pine Script's time-series model is translated into the ctx.run() implicit execution wrapper.
  • Array access like close[1] is preserved natively using ES6 Proxies.
  • The var keyword translates into our persistent state object.

Drawing Object Wrappers

Standard Pine Script drawing objects are fully supported and mapped into the Canvas 2D engine behind the scenes:

// These standard Pine commands work natively after transpilation!
box.new(left, top, right, bottom, bgcolor, border_color)
line.new(x1, y1, x2, y2, color, style, width)
linefill.new(line1, line2, color)
label.new(x, y, text, style, color, textcolor)