Skip to main content

Compare a Pine Script Backtest with TradingView

Compare Studio's order-based Strategy Report with TradingView's strategy results using the same script, data, inputs, and simulation assumptions. Matching metric names are not enough. An AI Edge Optimizer score is not a substitute for that comparison.

AI Edge Studio lets you edit supported Pine Script® and investigate strategy behavior in the browser. TradingView® is the platform that defines Pine Script. Studio supports part of the language, and successful compilation alone does not establish identical behavior. Read the compatibility guidance before choosing a tool for your script.

Choose the Tool for the Task​

TaskA useful starting point
Edit a compatible script, inspect its chart, and explore input values in the browserAI Edge Studio. Check compiler and optimization diagnostics for your script.
Search settings across historical data and inspect selected trialsAI Edge Optimizer. Read the scoring basis before comparing results.
Verify behavior on TradingView's implementation of Pine Script or use a script that Studio does not supportRun it in TradingView and consult the official Pine Script documentation.
Evaluate a TradingView-specific data feed, chart mode, or feature absent from your Studio datasetUse TradingView for that configuration. Do not infer the missing behavior from a Studio result.

Studio's browser studies require sign-in; cloud studies require eligible paid access. A TradingView subscription or Paid Spaces purchase is a separate access route. Check current AI Edge access options and pricing rather than assuming either service includes the other.

Record the Same Experiment in Both Tools​

Start with one fixed configuration before comparing optimized candidates. The downloadable two-trade example is a small accounting check to inspect before you investigate a complex market backtest. Its expected results were verified with the runtime bundled with this website, not against TradingView. Save these details for both runs:

DetailWhat to align
SourceThe exact script text, version, and imported libraries. A matching script title is insufficient.
InputsEvery input value, including fixed values that were not searched.
Market dataSymbol, exchange or data provider, timeframe, session, timezone interpretation, adjustments, and actual bar timestamps and prices.
HistoryTesting start and end, plus the earlier bars available to initialize calculations.
Capital and exposureInitial capital, currency, position sizing, pyramiding, margin, and leverage assumptions.
CostsCommission type and value, slippage, and the units used for each.
ExecutionCalculation triggers, order delay, limit-fill assumptions, and any lower-timeframe or synthetic-chart price data used for fills.
MetricClosed profit versus profit including an open position, return period, and the base used for drawdown percentages.

Identical symbol labels do not prove identical price history. If you cannot obtain matching data, record the difference and limit the conclusion accordingly. A comparison with different data is not evidence that the engines are equivalent or that one is more accurate.

TradingView documents its own broker emulator and strategy properties. Use those definitions for the TradingView side and AI Edge's Strategy Properties and Broker Emulator guides for Studio.

Find the First Difference in Trades​

If the headline profit or trade count differs, inspect one entry and exit before changing parameters to make the totals look similar.

  1. Open Studio's List of Trades. Find the earliest entry that does not match the other run.
  2. Compare the surrounding bars, input values, and order direction, size, timestamp, and fill price. Distinguish an order's creation time from its fill time.
  3. Check whether the script recalculated after an order fill or within a bar. Review Script Execution.
  4. Check whether a stop, limit, margin condition, cost, or open position explains the result. Use the same closed-versus-open profit definition.
  5. Save a small example showing the source and attached libraries, data, settings, engine version, any fidelity notice and the first mismatch. If the assumptions align and it still differs, that example is useful for support.

Changing several settings at once makes it harder to identify the cause. Preserve the original run and note each change.

Respect Missing Data and Compatibility Limits​

Studio's Engine fidelity notice identifies features requiring additional data. Its current historical dataset does not supply lower-timeframe data for Bar Magnifier or high bar detail, or a separate standard-price feed for synthetic-chart fills. Historical candles do not contain the realtime ticks needed for realtime-tick recalculation. See What the Fidelity Notice Means.

A familiar report layout does not imply identical fills. Neither platform's historical simulation establishes the prices, liquidity, or outcomes available in a live brokerage account.

Compare a Study Score Separately​

A study scored on Signal Returns prices position changes at bar closes, without order-fill simulation or sizing. Its optional Signal Round-Trip Cost is a flat deduction before scoring; at its default of zero, the score excludes fees and slippage. A trial's profit factor can differ from the Strategy Report for those same Settings. A study scored on Executed Trades uses Studio's own order simulation, so it matches Studio's report, not necessarily TradingView's. Use Backtesting vs. Optimization to decide which result answers your question.

After any search, evaluate frozen settings on data that did not select them. Matching a past result across two tools helps investigate an implementation; it does not establish that a strategy is robust or profitable in the future.