Strategy Replay · Pine Script v6

Check the Pine subset before running a strategy

DayTradeDrill runs a tested subset of Pine Script version 6 for custom indicators and Strategy Replay. A familiar function name does not guarantee compatibility: validate the script, review diagnostics, and inspect whether the run completed.

Method

A safer way to validate a Pine strategy

  1. Start from a small v6 script

    Begin the source with //@version=6 and add a simple indicator or strategy declaration. Keep the example small enough to isolate a function or rule.

  2. Use a known supported formula

    Try the starter below, which uses SMA, EMA, crossover and strategy entry/close calls already used in the product editor.

  3. Validate and read diagnostics

    Validate before saving or applying. Fix syntax and parameter issues, and treat PINE_UNSUPPORTED_BUILTIN or PINE_UNSUPPORTED_SYNTAX as an explicit support boundary.

  4. Run against a chosen replay and inspect status

    Strategy Replay requires Pro. Choose the script, timeframe, parameters and run mode, then inspect orders, fills, costs, ledger and completion status. Do not interpret a failed or incomplete run as a full test.

Which Pine v6 patterns are included in the tested subset?

The current compatibility corpus tests 43 independently written examples: 24 compile in the implemented subset, 15 return an unsupported-builtin diagnostic, and four tuple forms return an unsupported-syntax diagnostic. This is a regression corpus, not a percentage of all Pine features.

  • The passing examples include SMA, EMA, RSI, ATR, Donchian channels, moving-average crossovers, and formula-based MACD, Stochastic and Williams %R.
  • Simple strategy calls used in the product starter include strategy.entry and strategy.close with supported series conditions.
  • A clean compile checks this implementation's parser and type rules; it does not prove numeric equivalence with TradingView.

Examples outside the current tested subset

Some valid Pine-looking code is parsed but deliberately marked unsupported so it is not silently treated as executable.

  • The regression corpus reports unsupported-builtin diagnostics for ta.vwap, ta.vwma, ta.wma, ta.hma, ta.sar, ta.cci, ta.stoch, ta.mfi, ta.cmf, ta.roc, ta.mom, ta.pivothigh, ta.barssince and ta.valuewhen. A Stochastic-RSI-style ta.stoch(ta.rsi(...)) combination is also outside this tested set.
  • Tuple forms such as ta.bb, ta.macd, ta.supertrend and ta.dmi receive an unsupported-syntax diagnostic in the current engine.
  • This list describes the tested boundary, not every unsupported Pine language feature. A successful autocomplete suggestion is not a guarantee that a whole script compiles.

Strategy results use a different execution model

The engine creates intrabar prices and volume from one-minute OHLC bars and applies its own deterministic events and order rules.

  • It is not historical tick data, a live broker connection or a source of executable market prices.
  • Results can differ because of data, warm-up history, costs, contract settings, supported script features, starting point and order simulation.
  • Strategy orders and performance use a separate ledger from manual trades. Partial records from an error or resource limit are for troubleshooting, not a complete performance result.

Example

Pine v6 strategy starter

This is the current starter source shipped in the custom strategy editor. Strategy Replay itself requires Pro.

//@version=6
strategy("Custom strategy", overlay=true)
period = input.int(20, "Period", minval=1, maxval=200)
average = ta.sma(close, period)
if ta.crossover(close, average)
    strategy.entry("Long", strategy.long)
if ta.crossunder(close, average)
    strategy.close("Long")

Scope

Do not assume full Pine compatibility

  • Only Pine Script version 6 is accepted by the current engine.
  • The implemented function and syntax subset is narrower than TradingView Pine; unsupported constructs return diagnostics.
  • One-minute OHLC input produces synthetic intraminute events; there is no tick-by-tick replay or live execution.
  • Results are not guaranteed to match TradingView or a broker, and simulated performance does not predict future returns.
  • Strategy Replay requires Pro and is separate from the manual-trading ledger.