Skip to content
Algo Trade Analytics Docs

Engine vs TradingView — what differs and why

Important

The Algo Lab runs your Pine Script on our own independent Pine v6-compatible engine, not TradingView’s official runtime. We aim for close behavioural parity with the documented Pine language, but the two engines are not bit-identical. A strategy that backtests as profitable here may produce different numbers — and occasionally different signals — when you run it on TradingView, on a broker, or with live capital.

Always re-validate strategies in your actual target execution environment before risking money.

TradingView does not expose the Pine Script runtime as an API. To run Pine scripts in a browser-based research lab — and to let an AI agent iterate on them at machine speed — we had to write a compatible runtime ourselves.

The independent runtime gives Algo Lab programmatic access to bars, indicators, trade lists, and intermediate research state. That allows repeatable backtests, parameter sweeps, and supervised Agent experiments without manually uploading each candidate to TradingView.

The cost is what this page is about: our engine is independent, and independent engines diverge.

The relevance of each source depends on the strategy and test scope:

Engines that compute the same arithmetic in different orders can produce slightly different floating-point results. For strategies whose entry condition sits on a numerical knife-edge — for example ta.crossover(ta.sma(close, 76), close) on a bar where the SMA and close are within 1e-10 of each other — one engine may fire the signal and the other may not.

Check: compare the condition inputs on the first bar where the engines diverge.

The way strategy.entry, strategy.exit, strategy.close, partial fills, market-on-close orders, commission application order, and margin computations are simulated is an independent implementation. Where the Pine specification leaves a behaviour ambiguous, our engine and TradingView’s may have made different choices.

Check: compare order identifiers, position changes, fills, costs, and strategy properties around the first different trade.

3. Session boundaries and exchange calendars

Section titled “3. Session boundaries and exchange calendars”

Handling of pre-market, after-hours, holiday closures, half-days, and exchange timezones is implemented independently. The RTH-only toggle in the lab toolbar mirrors TradingView’s Regular Trading Hours mode, but edge cases around session opens and closes may behave differently.

Check: compare exchange timezone, session template, and bars around opens, closes, holidays, and half-days.

4. request.security() and multi-timeframe lookback

Section titled “4. request.security() and multi-timeframe lookback”

Higher-timeframe data fetching and the rules for whether a higher-timeframe value is “available” on a given lower-timeframe bar are subtle. Our engine and TradingView’s may differ on how they handle the first bar of a new higher-timeframe period, on how lookahead=barmerge.lookahead_on repaints, and on holiday-gap behaviour.

Check: compare the higher-timeframe series bar by bar and record lookahead and gap settings explicitly.

Treatment of missing bars, weekends, illiquid periods, and trading halts may differ.

Check: confirm both engines received the same bar sequence before comparing strategy output.

Not every Pine v6 built-in function, library, or syntactic feature is implemented in our engine. We cover the strategy-development surface deeply; we cover the indicator-only and visualisation surface less deeply. Some features may be missing entirely or use a different default value.

Check: review the internal validator result and confirm the final source in TradingView. Do not infer support from the absence of a warning alone.

What this means for “verifier-pass” strategies

Section titled “What this means for “verifier-pass” strategies”

When the Algo Agent labels a strategy as verifier-pass or holdout-pass, it is making a statement about our engine’s output: the candidate beat the baseline on the chosen objective metric, on both the training and the held-out slice of historical bars, by margins that pass our statistical gates.

It is not a statement that:

  • The strategy will produce the same numbers on TradingView
  • The strategy will be profitable with real money
  • The strategy will work on a broker’s execution venue
  • The strategy will reproduce these results outside the historical date range

A verifier-pass is a green light to take the candidate seriously, not a green light to deploy.

If you intend to deploy a lab-validated strategy:

  1. Copy the candidate’s Pine source and paste it into TradingView’s editor
  2. Run TradingView’s Strategy Tester on the exact same symbol, timeframe, and date range
  3. Match the configuration — source version, inputs, sizing, capital, commission, slippage, session, and data window
  4. Compare events before aggregates — locate the first different entry or exit, then inspect net P&L, total trades, win rate, max drawdown, and profit factor
  5. Set a decision rule for this study based on the strategy, sample, and intended use. Algo Trade Analytics does not define a universal acceptable percentage difference between engines
  6. Investigate any decision-relevant difference using the six sources above before promoting the candidate
  7. Forward-validate outside the platform before risking capital, then compare externally observed alerts and fills with the expected events

Algo Trade Analytics is not affiliated with, endorsed by, sponsored by, or formally associated with TradingView, Inc. “Pine Script” is a trademark of TradingView, used here in a descriptive, interoperability-only sense to identify the language our independent runtime executes. We are not a TradingView product, partner, or reseller. Your use of strategies on TradingView is subject to TradingView’s own terms and pricing.