Backtesting guide
Backtesting vs forward testing: compare the evidence
Backtesting applies strategy rules to historical data. Forward testing records how frozen rules behave as new market data arrives. A forward test can use simulated orders or real money, so label those records separately. Compare signals and fills on the same dates before comparing P&L or drawdown.
Read the practical guideKey Takeaways
- Historical simulation, forward simulation, and real broker fills answer different questions; none guarantees future profit.
- Save the rules before the forward period begins. Parameter changes start a new version and a new sample.
- Rerun those frozen rules over the forward dates to isolate execution differences from different market periods.
- Reconcile missing trades, price differences, quantity, and fees before interpreting summary metrics.
Three records, three different kinds of evidence
TradingView distinguishes historical backtesting from testing on new market data. Its Pine strategy orders are simulated by a broker emulator. Running a strategy on a realtime chart does not turn its reported fills into real broker executions.
- Historical backtest: saved rules run on past data with a fill and cost model. Useful for inspecting many historical situations; vulnerable to overfitting and unrealistic assumptions.
- Forward simulation: decisions and simulated fills recorded as new data arrives, including paper trading. Useful for checking signal timing and the operating workflow; simulated fills do not establish actual liquidity or achievable execution prices.
- Live execution: orders and fills from a real broker account, with actual quantity and charges. Useful for measuring implementation and execution in that observed sample; it puts capital at risk and is not required to begin forward testing.
Freeze the experiment before collecting new trades
Create a dated test record before the first forward signal. Keep the original file when you fix a bug or change a parameter, assign the revision a new version, and separate its results. Retuning on the forward sample turns that sample into development data.
- Rules: source version or file hash, input values, entry and exit conditions, order types, sizing, pyramiding, and risk limits.
- Market context: exchange-qualified symbol, timeframe, standard or synthetic chart, session, data feed, and warm-up history.
- Execution: bar-close or intrabar calculation, order-submission timing, fill model, commissions, assumed spread/slippage, and financing where relevant.
- Sample: start and end timestamps, timezone, currency, initial capital, open-position treatment, and a review date chosen before seeing the outcome.
Match the same dates and signal identifiers
A five-year backtest and two weeks of paper trading cover different markets and sample sizes. For execution reconciliation, rerun the frozen strategy over the exact forward period and retain the earlier historical study separately. Preserve the original forward log before refreshing charts: realtime calculations and subsequently rebuilt historical bars can disagree.
- Use a match key such as version + exchange:symbol + timeframe + signal-bar timestamp + direction + entry sequence. A broker order ID alone cannot identify the corresponding backtest signal.
- Store signal time, order-submission time, and fill time separately. Record whether a timestamp marks the bar open or close; normalize offsets to UTC without discarding the original timezone.
- Example: a 14:30:00Z signal, 14:30:01Z submitted order, and 14:30:03Z fill are three events. Matching only the fill time to a bar label can incorrectly mark the trade as missing.
- Keep unmatched signals and extra live trades in the reconciliation. Report both the matched-trade subset and the full sample so missing trades cannot disappear from the totals.
Difference checklist: symptom, evidence, next check
Work through these rows in order. Change one explanation at a time and retain the source log that supports it. A worse result alone does not identify a broken strategy.
- Signal exists in only one record | Compare version, inputs, symbol, session, and the original signal log | Check calculation timing, unfinished bars, higher-timeframe confirmation, and revised history before blaming execution.
- Signal matches but no order was submitted | Compare signal and submission logs | Check alert configuration, delivery, manual omissions, and risk filters; classify the event as missed rather than assigning an invented fill.
- Order was submitted but no matching fill exists | Inspect broker acceptance, rejection, cancellation, and partial-fill records | Check order validity, buying power, expiry, and quantity. Submission is not execution.
- Direction matches but price or time differs | Compare order type, signal time, fill time, and bid/ask evidence | Check bar-close versus next-tick assumptions, latency, gaps, and the simulator fill model.
- Prices match but net P&L differs | Recompute from executed quantity, contract multiplier, currency conversion, and charges | Separate fees from price slippage; do not deduct a spread already captured in actual fill prices twice.
- Net P&L matches but drawdown differs | Compare equity timestamps, open P&L, cash flows, and peak definition | Align closed-equity or mark-to-market sampling before comparing depth and recovery time.
Worked example: explain a $150 profit gap
This hypothetical example uses one fully closed long trade in 100 shares, USD accounting, no currency conversion, no financing, and no partial fills. The prices and fees are invented for arithmetic, not a performance claim. Net P&L = (exit price - entry price) × shares - total fees.
- Historical rerun: entry $100.00, exit $105.00, total fees $10.00. Net P&L = ($105.00 - $100.00) × 100 - $10.00 = $490.00.
- Forward paper record: entry $100.20, exit $104.90, total simulated fees $10.00. Net P&L = $470.00 - $10.00 = $460.00.
- Actual broker record: entry $100.80, exit $104.40, total fees $20.00. Net P&L = $360.00 - $20.00 = $340.00.
- Live minus historical = -$150.00: worse entry costs $80.00, worse exit costs $60.00, and additional fees cost $10.00. The observed gap is fully accounted for in this example; the logs are still needed to explain why prices differed.
- The paper result was $120.00 above the real result. A profitable forward simulation did not establish that the same fills were available in the real account.
Compare drawdown only after aligning the equity basis
For a hypothetical $10,000 account, closed equity of $10,000, $10,500, $10,200 has a $300 drawdown, or 2.86% of its $10,500 peak. If a comparable marked equity series reaches that same peak and then falls to $9,800 while a position remains open, its drawdown is $700, or 6.67%. Both calculations can be correct. A closed-trade CSV alone cannot reconstruct every intrabar account-equity observation.
- Compare the same currency, capital, date window, cash-flow treatment, position sizing, valuation frequency, and percentage denominator.
- Retain trade count, exposure, open positions, maximum loss, and drawdown duration alongside net P&L. A smaller forward sample can miss losses that occurred in the longer history.
- Set review rules in advance. Investigate missing signals, duplicate orders, breached risk limits, and unexplained costs immediately; there is no universal acceptable divergence percentage or trade count that proves stability.
Keep the historical file and the forward journal separate
Backtest Deep Report analyzes a compatible TradingView strategy trade-list CSV. Use the trade table export, with trade identifiers, entry/exit types, dates, prices, quantities, and net P&L. Arbitrary OHLC data, a summary screenshot, or a broker statement is not an equivalent input. After import, compare the parsed trade count, timestamps, currency, and net P&L with the original; confirm the open-trade setting before using the report.
- Trading Journal supports named journals, trade tags, plan/review notes, entry details, close records, fees, and missed-trade reasons. Create separate journals such as Forward paper v1 and Live v1, and put the version and source signal ID in notes.
- Paper and live labels are your record-keeping convention, not a simulator or a broker execution mode inside Journal. Enter the records from the corresponding source and preserve the original paper or broker log.
- Use Journal history CSV export for a summary comparison. Retain source fill records and notes for detailed timestamps and charges not included in that export. This workflow uses manual journal entry; the Report importer is a separate workflow.
- The two products do not automatically match each forward trade to its historical counterpart. Reconcile them using the identifiers and checklist above before interpreting either report.
Direct Pineify workflow
Record the forward sample with its source and version
Use separate named Trading Journals for paper and live records, with tags and notes for the strategy version and signal ID. Analyze the historical TradingView trade-list CSV in Backtest Deep Report, then reconcile the records.
Record forward trades, fees, notes, and missed-trade reasons in separately named journals.
Open Trading JournalInspect the compatible TradingView trade-list CSV saved for the historical comparison.
Analyze the historical CSVBoundary: Journal records what you enter; it does not simulate or execute orders. Backtest Deep Report does not run the strategy, establish achievable fills, or automatically reconcile the two datasets. Neither guarantees future performance.
Primary sources
- TradingView: Strategies, broker emulator, and forward testingVerified 2026-10-17
- TradingView: Repainting and historical versus realtime calculationsVerified 2026-10-17
- TradingView: Paper Trading uses simulated moneyVerified 2026-10-17
This page is educational and does not provide investment advice. Backtests are hypothetical, depend on their data and assumptions, and do not guarantee future results. Trading can result in substantial loss.