Backtesting guide
Backtesting Simulators: Check the Model Before the Result
A backtesting simulator applies strategy rules to historical observations and models orders, positions, cash, and performance. Results depend on what the engine observes and assumes between observations; a detailed report does not establish realistic execution.
Read the practical guideKey Takeaways
- Bar resolution does not reveal every transaction or guarantee a fill.
- Separate strategy decision frequency from intrabar execution detail.
- Document cost, margin, cash, and open-position assumptions.
- Pineify supports code and report workflows; the selected platform runs the historical simulation.
Identify what drives the simulation
Some engines respond to each modeled event; others calculate signals over arrays and apply accounting rules afterward. A bar-based engine does not observe every price inside a bar. One-minute OHLC data still leaves the sequence of trades, quotes, and available liquidity unknown. Distinguish the frequency of strategy decisions from the resolution used to model fills. Adding lower-timeframe data to resolve an order is different from changing a daily signal into a one-minute signal. The latter can change the strategy itself, so it is not a controlled comparison of execution accuracy.
Work through one ambiguous bar
Consider a hypothetical long position with an active stop at $95 and target at $105. A later bar has a high of $106 and a low of $94. Those extrema show both prices were reached but not which came first. An assumed intrabar path can determine which exit wins. Lower-timeframe data may resolve the ordering, but gaps or limited resolution can leave uncertainty. Inspect a small set of these cases manually against the documented engine rules. Also test a gap through a stop, an unfilled limit order, a partial exit, and a rejected order where the platform supports those events. The question is whether the model implements the intended rules, not whether it produces the most attractive equity curve.
TradingView and MetaTrader use specific models
TradingView runs Pine Script strategies through its broker emulator. Review the current calculation, order-processing, and intrabar-detail settings, along with commission and slippage. Standard chart prices avoid some issues associated with synthetic chart types, but do not guarantee real fills. MetaTrader 5 tests MQL5 Expert Advisors and offers generated-tick, real-tick, one-minute OHLC, and other modeling modes. One-minute OHLC does not mean every tick in that minute. Its tester also supports multi-symbol EAs and execution-delay settings. Read the mode limitations: profit calculation in pips omits swap and commission calculations and does not perform margin control. Neither engine runs the other platform's source language directly. Choose the engine for the implementation, instruments, and account model being tested.
Check costs, capital, and open positions
Record commission, spread treatment, slippage, funding or swap, currency conversion, margin, and quantity rules as applicable. Avoid double counting costs already reflected in bid/ask prices or imported profit. Keep both realized trade results and the account valuation path when the engine provides them. Closed-trade equity can miss risk while a position remains open. A multi-symbol strategy needs shared cash and simultaneous position accounting; combining separate reports is not equivalent. A finer data resolution can help with specific assumptions, but does not by itself model your queue position, market impact, or future liquidity.
A free test is an entry point with defined limits
TradingView offers Basic access with plan-dependent history and report functions. Check the current plan table and actual symbol history. For MetaTrader, available broker history, symbols, and account specifications constrain the test; remote compute or other services can have separate costs. Do not treat free access as a promise of every data source or simulation mode. Save a baseline, inspect the trade list, and test changes to relevant assumptions. Keep later data out of parameter selection. Forward simulation can expose operational differences, but simulated orders still do not demonstrate actual fills or future profitability.
Pineify supports preparation and analysis
The Pine Script AI Coding Agent can draft editable strategy source from written rules. Review and test the final script in TradingView; a syntax check does not verify the trading logic. Strategy Optimizer automates selected TradingView inputs, and Backtest Report analyzes a compatible exported CSV. The report's Monte Carlo feature resamples historical trade profit/loss values with replacement. It does not replay the strategy on newly generated price paths or prove the absence of overfitting. Trade-level metrics also need their input definitions and ordering checked before they are compared with platform account statistics.
Primary sources
- TradingView: Strategies and broker emulatorVerified 2026-10-20
- MetaTrader 5: Strategy testing and modeling modesVerified 2026-10-20
- TradingView: Plans and feature comparisonVerified 2026-10-20
This page explains simulation methods. Backtests are hypothetical, depend on model assumptions, and do not guarantee future performance. Trading can result in substantial loss.