Backtest Trading Strategies: Check Rules, Data and Fill Assumptions
A strategy backtest applies rules to historical information and simulates orders under an execution model. It can expose implementation errors and estimate historical outcomes under stated assumptions. It cannot by itself establish that an advantage is real, that orders would have filled identically or that the strategy will remain profitable.
Key Takeaways
- Keep the rules, source version, data and simulation settings with each result.
- Check individual decisions before interpreting aggregate metrics.
- Separate parameter selection from later evaluation and record all variants tried.
- Resampling trades is a conditional analysis, not a new market backtest.
Define a reproducible experiment
Specify the instrument, date interval, timezone, sessions, bar type, entry and exit events, order types and sizing. Choose data consistent with what could have been known at each decision. For a stock universe, document historical membership and delistings; for adjusted prices or futures series, record the adjustment and rollover convention.
- Include warm-up data without treating it as evaluation trades.
- Specify when orders are created and when the simulator permits them to fill.
- Preserve the raw report and exact source rather than only an equity screenshot.
Inspect the fill and cost model
TradingView’s default strategy calculation and broker emulator use specific timing and intrabar assumptions. Settings such as recalculation, processing at bar close and Bar Magnifier change the simulation. Bar Magnifier uses lower-timeframe data where available; it is not a live order-book replay.
- Commission can be modeled separately from slippage. Pine’s slippage setting is in ticks, not bars.
- Test sensitivity to costs, delayed orders and missed fills when relevant.
- Use standard price charts or explicitly address synthetic prices on non-standard charts.
- Check several entries and exits against the data and rule timing before optimizing.
Keep selection separate from evaluation
Look-ahead bias uses information before it was available. Survivorship bias changes the tested universe by omitting failed or removed members. Overfitting selects rules that exploit historical noise. None is resolved by a high win rate or one attractive chart.
- Choose chronological evaluation dates before searching settings.
- Walk-forward studies repeat selection using only earlier data, then evaluate later data; they still have assumptions and sampling uncertainty.
- If a held-out result leads to another revision, it is now part of development evidence.
- Inspect different conditions without labeling an entire long period as a single uninterrupted regime.
Interpret metrics with their definitions
Net profit, trade count, exposure, payoff sizes and drawdown answer different questions. Profit factor is gross profit divided by the magnitude of gross loss; it is undefined or convention-dependent when there are no losses. Sharpe calculations depend on return frequency, risk-free assumptions and annualization. Historical drawdown is not a maximum future loss.
- Hypothetical sample: 30 gains of $3 and 70 losses of $1 produce $20 before costs despite a 30% win rate.
- There is no universal profit-factor or Sharpe threshold that certifies a strategy.
- Check whether returns include open positions and how cash flows and position sizes are handled.
- Compare the same metric definition across tools before treating values as comparable.
Understand what a trade bootstrap changes
A bootstrap samples observed trade returns with replacement. Some trades can be repeated and others omitted, changing sample composition. A pure reordering of fixed monetary profits leaves their sum unchanged; reordering fixed multiplicative returns leaves terminal compounded wealth unchanged, though drawdown can change. Position-dependent constraints can alter those conclusions.
- Neither operation creates new price paths with genuinely new information.
- Independent resampling does not preserve serial dependence or market-regime structure.
- Pineify’s Monte Carlo tool resamples trade returns; its reported ruin measure uses terminal equity, not every interim breach of a chosen threshold.
- Scenario percentiles depend on the sample and method and are not unconditional forecasts.
Use Pineify at the relevant stage
Pineify can draft Pine source from a specification. Compile and run it in TradingView. With Advanced or above access, the Strategy Optimizer searches exposed inputs of the existing strategy. Backtest Report analyzes a compatible trade CSV; that analysis does not rerun the source on historical prices.
- Keep code generation, native simulation, parameter search and CSV analysis as separately documented steps.
- An optional AI report request is distinct from the local report calculations.
- Check current platform, data and Pineify entitlements instead of assuming the whole workflow is free.
Sources and verification
Last verified:
Educational information, not investment advice or a record of tested returns. Examples illustrate mechanics. Trading can lose money, and historical or simulated results do not guarantee future performance.