Exciting Update: Version 1.0.6 is now available, introducing Direct Pine Script Mode, Pine Logs Runtime Bridge, Zero-Repaint Linting, Source Maps, Intrabar MFE/MAE Stats, and expanded Pine v5/v6 Transpiler Parity. Read more

Release Notes

Version 1.0.6 (Latest Release)

Released: November 2026

Version 1.0.6 is a landmark upgrade across both the BacktestX Script Editor and the Pine Script Transpiler & Simulation Runtime. Scripts can now be written, linted, profiled, debugged with runtime Pine Logs, and executed in Pine Script directly without leaving the editor—powered by major Pine v5/v6 language parity, commission/slippage/pyramiding strategy accounting, compile-time zero-repaint diagnostics, Pine source maps, intrabar MFE/MAE analytics, and BacktestX-exclusive visual interactivity primitives.

  • Direct Pine Script Mode (Auto-Compile Without Converter Modal):
    • Automatic Detection & Toolbar Switcher (langModeBtn): Detects Pine Script syntax (//@version=, indicator(...), strategy(...)) and adds per-tab language modes (Auto · Pine, Auto · JS, Mode · Pine, Mode · JS), Pine syntax highlighting, and a pine_ema starter template.
    • Unified Compile, Lint, Profile, Save & File I/O: Underlying compileScriptSource transpilation powers live gutter linting (runLiveLint), benchmarking (profileBtn), sub-pane allocation on overlay=false, editable Pine sourceCode persistence on state.customScripts, and .pine / .pinescript import/export.
  • Pine Logs Runtime Bridge (log.info, log.warning, log.error) & Bar Highlighting:
    • Per-Bar Streaming Telemetry: Captures up to 500 runtime log entries per script with {0} placeholder formatting, exact bar index synchronization, and timestamp metadata via deduplicated cl:script-logs events.
    • Interactive Editor Console Filtering & Chart Jump: Includes Pine Logs pill filtering, bar timestamp from/to range filtering, #bar index search, and clickable log rows that pan to, highlight the target bar on the chart canvas, and show a Back to Script Editor / Dismiss (Esc) banner.
  • Autocomplete, Live Signature Hints, Hover Docs, Folding & Safe Formatting:
    • Expanded API Catalog & Local Symbol Completions: Added completions and documentation for ctx.ta.*, ctx.log.*, ctx.plot*, ctx.box.new, ctx.label.new, ctx.polyline.new, ctx.polygon.new, ctx.session.in_range, ctx.ticker.heikinashi, ctx.is_hovered, Pine shorthands, local symbols, and prefix-first ranking.
    • Parameter Hints & Upgraded Hover Tooltips: Live argument signature tooltip (signatureBox) inside (...) with active parameter highlighting, plus hover documentation across ctx.*, Pine globals, and user symbols.
    • Pine Folding, Indentation & Comment/String-Safe Formatting: Indentation-based folding blocks for Pine Script, 4-space auto-indent on Enter, and token-aware formatting preserving Pine indentation while ignoring braces inside strings, template literals, and comments.
  • Built-in Price, Time, Session, Ticker, Barstate & Syminfo Series:
    • Derived Price & Bar Metadata: Exposed hl2, hlc3, ohlc4, hlcc4, last_bar_index, last_bar_time, and timenow.
    • Calendar & Timezone Accessors: Added hour, minute, second, dayofmonth, dayofweek (including .sunday–.saturday), month, year, and weekofyear supporting both bar-level scalar access and fn(time, tz).
    • Lifecycle, Metadata, Sessions & Heikin-Ashi Security: Full barstate.* flags (isfirst, islast, ishistory, isrealtime, isnew, isconfirmed, islastconfirmedhistory), metadata-backed syminfo.* (ticker, tickerid, prefix, root, currency, basecurrency, timezone, mintick, type), session.* (in_range, ismarket, ispremarket, ispostmarket, regular, extended), and ticker.heikinashi / standard / new resolved inside request.security.
  • Control Flow, User Types & Language Constructs:
    • Value-Returning Conditionals & Switch Arms: Added x = if ... (with else if/else) and IIFE-wrapped x = switch ... expressions plus standalone multi-line and single-line switch blocks.
    • Countdown Loops, Array Iteration & Tuple Destructuring: Runtime step-sign checks enable negative-step countdown loops (for i = 10 to 0 by -1), for [idx, val] in arr collection iteration, and [a, b] = fn() destructuring on user functions.
    • UDTs, Enums, Extension Methods & Vector Polylines: Added enum blocks, type definitions, type-dispatched method dot-calls with this binding across single-line and multi-line bodies, chart.point.* coordinates, and polyline.new (with quadratic Bezier curved splines, closed paths, and gradient fills).
  • Plot Handles, Styles, Stdlib & Realistic Strategy Accounting:
    • Assigned Plot/Hline Handles & Plot Styles: Variable-assigned p1 = plot(...) and h1 = hline(...) handles pass directly into fill(); added histogram, columns, circles, cross, stepline, area, and linebr styles, dynamic per-bar color arrays, offset, histbase, and color.gradient linear gradient fills.
    • True Range, Pivots, BacktestX TA & Extended Stdlib: Gap-aware ta.tr, non-repainting 2-arg and 3-arg ta.pivothigh / ta.pivotlow, ta.sar + BacktestX TA adapters (lrc, mcg, cks, ce, fisher, crsi, cvd, bop, cho, ci, bbtrend), expanded math.* / str.* functions, and quote/comment-safe out-of-order named argument resolution.
    • Commissions, Slippage & Pyramiding: Strategy engine now deducts commission_type (percent, cash_per_contract, cash_per_order) / commission_value, applies slippage ticks scaled by syminfo.mintick, maintains weighted average position_avg_price across pyramiding entries, and exposes netprofit, grossprofit, grossloss, wintrades, losstrades, opentrades, and closedtrades.*.
  • Zero-Repaint Linter, Source Maps & BacktestX-Exclusive Capabilities:
    • //@strict-no-repaint & Line Source Maps (transpilePineToJSWithMap): Flags barmerge.lookahead_on, negative series offsets, and forward bar_index reads at compile time while mapping syntax errors directly back to the exact Pine source line.
    • Intrabar MFE/MAE Stats, Custom KPIs & Trade Tags: Computes Max Favorable Excursion (mfe) and Max Adverse Excursion (mae) per closed trade (accessible via strategy.closedtrades.mfe(i) / .mae(i)) alongside strategy.set_metric, strategy.tag_trade, automatic MFE / MAE trade tags, and summary KPIs (Avg MFE, Avg MAE, Total Commission).
    • Fib Retracements, Cursor Interactivity & Raw JS Blocks: Enhanced fib.new() (accepting chart.point anchors, custom levels, extend, and dynamic setters), wired polygon.new(), exposed live cursor state (mouse.x, mouse.y, mouse.is_down, mouse.clicked, is_hovered(...)), enabled tooltip= hit-testing on box.new / label.new, added request.timeframe_data(...), and introduced //@js-raw ... //@end-js-raw inline JavaScript / Canvas 2D blocks.

Version 1.0.5

Released: October 2026

This major release upgrades the BacktestX Strategy Engine to professional-grade parity with Pine Script v5/v6. It introduces native Bracket Orders, dynamic Trailing Stop Losses with real-time watermark ratcheting, standalone Pending Resting Orders with explicit cancellation, flexible Capital & Compounding Position Sizing (percent_of_equity, cash, fixed), automated Risk Management Guard Suite that halts simulations upon breach, and automatic bar loop index synchronization.

  • Native Bracket Orders & Take Profit / Stop Loss (ctx.strategy.exit): Attach bracket profit and stop loss protection directly to open positions with multi-tick execution and bar-by-bar evaluation (profit, loss, limit, stop).
  • Dynamic Trailing Stop Loss (trail_points, trail_offset): Full watermark tracking that monitors the highest high (longs) or lowest low (shorts) achieved while in trade, automatically ratcheting stop prices upward/downward as the position moves deeper into profit.
  • Resting Pending Limit & Stop Orders (ctx.strategy.order): Place standalone pending orders that rest in an execution queue across future bars until market price triggers execution, enabling pullback limits, breakout stops, and scale-in ladders.
  • Explicit Order Cancellation (ctx.strategy.cancel & ctx.strategy.cancel_all): Programmatically cancel resting orders by unique order ID or purge the entire resting queue when trend invalidation or opposite signals occur.
  • Capital & Compounding Position Sizing: Configure ctx.strategy.config() with default_qty_type supporting ctx.strategy.percent_of_equity (dynamic compounding based on floating equity), ctx.strategy.cash (fixed dollar allocation per trade), or ctx.strategy.fixed (unit/contract sizing).
  • Automated Risk Management Guard Suite (ctx.strategy.risk.*):
    • ctx.strategy.risk.max_drawdown(value, type): Automatically terminates execution and liquidates positions when portfolio drawdown exceeds threshold.
    • ctx.strategy.risk.max_intraday_loss(value, type): Restricts further entries for the remainder of the calendar day once daily loss limit is reached.
    • ctx.strategy.risk.max_cons_loss_days(count): Halts simulation after consecutive losing days.
    • ctx.strategy.risk.max_intraday_filled_orders(count): Hard-caps the number of filled trades allowed per day to avoid overtrading.
    • ctx.strategy.risk.max_position_size(count) & allow_entry_in(direction): Enforces position exposure and directional gating (Long-only, Short-only, or bidirectional).
  • Seamless Bar Loop Synchronization: BacktestX automatically synchronizes ctx.strategy.current_index / ctx.strategy.bar_index during standard loops (for (let i = 0; i < bars.length; i++)), eliminating trade 0 desync issues.

Version 1.0.4

Released: September 2026

This release enhances developer productivity in the Script Editor with an interactive 3-Option "New Script" Modal and a comprehensive Script Version History & Reversion Manager with 1-click snapshot restore.

  • 3-Option New Script Modal: Clicking the "New" button () in the Script Editor now prompts you with three creation workflows:
    • Custom Indicator Template: Standard boilerplate script with canvas viewport bounds, price mapping math, and moving average calculation loops.
    • Strategy Backtesting Template: Full trading strategy template with dynamic ATR trailing stops/targets, position entries/exits, and Strategy Tester metrics.
    • Built-in Indicator Library & Blank: Spawn ready-to-run source code from the 169+ open-source technical indicator library modal or start from a blank canvas.
  • Script Version History Button: Added a dedicated History button () on the Script Editor top action bar (script-history).
  • Timestamped Revision Tracking: Every script compilation and save automatically generates an indexed snapshot capturing exact code revisions, timestamps, and line counts.
  • 1-Click Instant Restore & Rollback: Preview previous script versions with syntax-highlighted code inspection and restore previous revisions directly into the active editor buffer with zero data loss.

Version 1.0.3

Released: September 2026

This update introduces fully interactive Inputs and Style Tabs for custom indicator scripts and Pine Script transpiler conversions. Script authors can now declare user-configurable parameters and visual styling hooks, allowing end-users to tweak settings (lengths, sources, thresholds, offsets, colors, line thicknesses, and dash styles) directly in the UI without editing code.

  • Dynamic Inputs Tab Generation: Declaring ctx.input(key, defaultValue, options) automatically builds interactive steppers, sliders, dropdowns, checkboxes, groups, and inline rows in the indicator settings dialog.
  • Pine Script Input Helper Aliases: Added comprehensive support for input.int(), input.float(), input.string(), input.source(), input.bool(), and input.color().
  • Dynamic Style Tab Generation: Declarative rendering methods (ctx.plot, ctx.hline, ctx.fill, ctx.plotshape, ctx.plotchar, ctx.plotcandle, ctx.plotbar) now automatically register their titles, colors, line thicknesses, and dash patterns into the Style tab.
  • Options Object Schema: Standardized the options object format ({ title, color, width, style, trackprice }) for all plot calls, ensuring user custom colors and styles persist seamlessly.
  • Price Source Extraction Helper: Standardized price extraction patterns (Close, Open, High, Low, HL2, HLC3, OHLC4) for technical indicator scripts.
  • Visual Offset Shifting: Support for displacing/shifting calculated series arrays forward or backward in time using offset parameter mappings.
  • Multi-Value TA Destructuring: Comprehensive destructuring patterns and documentation for ctx.ta.supertrend, ctx.ta.bollingerBands, ctx.ta.macd, and ctx.ta.ichimoku.
  • Dedicated Sub-Panels: Simplified oscillator pane creation with ctx.pane = 'new'.

Version 1.0.2

Released: August 2026

This major feature update brings a massive expansion to the ctx.ta.* technical analysis library. The script engine now has complete parity with the core technical indicators available in other major trading platforms, allowing you to rapidly port logic and avoid writing complex math from scratch.

  • Moving Averages Expansion: Added ta.rma (Running Moving Average), ta.hma (Hull Moving Average), ta.alma (Arnaud Legoux Moving Average), and ta.linreg (Linear Regression).
  • Oscillators & Channels: Added highly requested ta.supertrend and Keltner Channels (ta.kc). Also added Money Flow Index (ta.mfi), True Strength Index (ta.tsi), and Williams %R (ta.wpr).
  • Statistical Math: Added standard deviation (ta.stdev), variance (ta.variance), series correlation (ta.correlation), and percentile ranking (ta.percentrank).
  • Logic & Lookback Helpers: Expanded beyond simple crossovers to include ta.cross (bidirectional), ta.rising, and ta.falling logic checkers for continuous trend momentum.

Version 1.0.1

Released: July 2026

This minor release introduces highly requested Custom UI hooks for the Strategy Tester. Script authors now have complete programmatic control over the capital and metrics displayed in the bottom terminal panel, allowing for dynamic, strategy-specific performance tracking and tailored trade metadata.

  • Custom Strategy UI APIs: Introduced ctx.strategy.setMetric(label, value, color) to inject custom top-bar metric blocks directly into the Strategy Tester dashboard.
  • Custom Trade Columns: Introduced ctx.strategy.tagTrade(id, column, value, color) to append dynamic columns (like Confidence Scores) to individual trades in the Strategy Tester table.
  • Script-Driven Capital: Introduced ctx.strategy.initial_capital(amount, currency). Scripts can now dictate their required starting capital, which automatically updates the Strategy Tester UI dropdown and re-calculates all PnL percentages.
  • Capital UI Defaults: The default fallback initial capital has been reduced from 1,000,000 USD to a more realistic 10,000 USD.
  • Opening & Closing Positions: Added comprehensive documentation and robust support for ctx.strategy.entry, ctx.strategy.close, and the advanced ctx.strategy.exit function (supporting trailing stops and brackets).
  • Risk Management Engine: Added math enforcement for ctx.strategy.risk.max_drawdown and ctx.strategy.risk.max_intraday_loss to automatically halt trading based on equity limits.
  • Real-Time Tracking Variables: Exposed ctx.strategy.position_size, ctx.strategy.position_avg_price, and ctx.strategy.openprofit() for dynamic position sizing calculations directly inside strategy scripts.

Version 1.0.0

Released: Initial Launch

The initial launch of the BacktestX Scripting Engine. This release establishes the core JavaScript sandboxing environment, providing a robust foundation for building high-performance, interactive technical indicators and automated trading strategies directly within the browser.

  • Sandboxed Script Engine: Introduction of the core JavaScript indicator overlay engine with full canvas clipping and safety checks.
  • Drawing APIs: Native support for drawing lines, boxes, splines, and filling areas between indicators.
  • Strategy Engine: Base support for ctx.strategy.entry, close, and exit with position sizing and Net Profit calculation logic.
  • Implicit Execution: Support for Pine Script-like implicit execution loops via ctx.run() with stateful proxy tracking for previous bar lookbacks.