9 min
A strategy can win 45 of 100 trades and still make a gross profit if its winners are large enough. Add realistic costs and the same sample can become unprofitable. Build the test so that difference stays visible.
Author

The candle touches both the stop and target. Its open, high, low and close do not reveal which order would have filled first. A historical result can change when the testing engine supplies an intrabar path you never examined.
Backtesting a trading strategy means reconstructing decisions using historical information and stated execution assumptions. The useful output includes those assumptions, the missed trades and the failure cases. A rising equity curve by itself leaves too much unexplained.
A backtest applies specified rules to past observations. It can show how that implementation behaves under the selected data, costs and execution model. It cannot demonstrate that the same opportunities or fills will exist in a future market.
Write the rules before running the test: instrument, session, signal, confirmation time, order, quantity, exit and cancellation. If a pivot requires two later candles for confirmation, the signal cannot use that pivot before those candles close.
Separate strategy selection from evaluation. Suppose you use one historical interval to develop the idea and another to compare alternatives. Keep a later period untouched for the final evaluation. Once you change the method after inspecting that later period, it has become part of development too.
Record every version tested. A result selected from 100 alternatives has benefited from 100 chances to fit history. The final report should preserve the selection process as well as the winning parameter set.
Choose the exact symbol, data feed, session and timezone. A cash index, a futures contract and a broker's index CFD can show different trading hours and prices. A TradingView chart symbol must match the product whose costs and execution you intend to model.
Hide future bars or use replay where your plan supports the required history and intervals. At each decision point, save the level, the time the signal became available and the order you would submit. Reveal the next observations only after recording the decision.
For a simple example, require a completed close above a known resistance level. Submit the research entry at the next available quote, with a defined maximum price and cancellation time. A later low touching your desired limit cannot establish a fill if the order had already expired.
Track every qualifying occurrence, including unfilled entries and signals you would skip. Keep commission, spread treatment and stop execution in separate fields. If your entry and exit already use executable bid and ask, avoid adding the spread a second time.
TradingView's strategy documentation explains its broker emulator and modelling features, including costs and execution assumptions. Plan access and available history vary. Check those limits when comparing TradingView backtesting free tools with paid features or a separate backtesting platform.
The MT5 strategy tester runs trading programs against historical data. You need an Expert Advisor implementing the rules you want to test. An indicator drawing arrows does not by itself specify the size, submitted order, exit or failed-order response.
Select the program, symbol, interval, date range and modelling mode. Then set account currency, initial capital, leverage where relevant and the program inputs. Save this configuration with the result so another run can reproduce it.
Tick modelling matters for a strategy using intrabar stops or short targets. Real-tick data can supply more detailed observations where available, while other modes generate or simplify the sequence. Confirm the broker's history coverage and inspect gaps before interpreting the resulting fills.
Use a visual run to examine a small number of trades. Check whether the order appears after the signal becomes known, whether volume is rounded correctly and whether a closed position can accidentally be reopened on the same event. Those checks can expose a coding error before optimisation hides it inside a large result.
Optimisation searches parameter combinations. It does not independently validate the selected strategy. Keep a ledger of the ranges searched, the selection criterion and the later evaluation period before running another sweep.
Begin with a data inventory. Record provider, timestamps, sessions, missing intervals and any adjustments. For share strategies, a current list of surviving stocks can exclude delisted failures. Corporate actions also require consistent treatment of prices and quantities.
For futures, document contract rolls and whether a continuous series is adjusted. A jump introduced by switching contracts can create a signal that no single contract experienced. Test execution on the actual tradable instrument and period.
Intrabar ambiguity needs its own rule. Suppose a bar opens at $100, reaches $104, falls to $97 and closes at $103. With a $98 stop and $104 target, OHLC alone cannot establish the sequence. Use suitable finer data or record the ambiguity under a conservative, predeclared method.
The following sample is hypothetical. Forty-five winners at +2R and 55 losers at −1R produce +35R gross across 100 trades. Here R is the planned price-risk unit before costs.
| Assumed round-trip cost per trade | Total costs over 100 trades | Result after those costs |
|---|---|---|
| 0R | 0R | +35R |
| 0.20R | 20R | +15R |
| 0.40R | 40R | −5R |

Figure 1. A hypothetical 100-trade sample has a gross +35R result. Assumed costs of 0.20R and 0.40R per trade reduce it to +15R and −5R respectively.
Win rate is 45% in all three rows. Gross profit factor is 90 / 55, or approximately 1.64. Charging 0.20R to each trade reduces winning trades to 1.80R and increases losing trades to 1.20R, producing a net profit factor of 81 / 66, or about 1.23.
Add adverse execution scenarios. Wider spreads, missed limit fills and a delayed exit can matter more than a small change in an indicator period. Use assumptions supported by quotes for the product and intended session. Keep the advertised minimum spread separate from the historical cost model.
Overfitting occurs when the chosen rules capture peculiarities of the development sample that fail to generalise. Warning signs include many parameters, narrow profitable settings and rules added after inspecting individual losses.
Compare neighbouring settings. If a 19-period parameter produces an exceptional curve while 18 and 20 fail badly, investigate the sensitivity. A broad region of acceptable results can be more informative than one isolated optimum, though it still needs later testing.
Keep the trading logic economically understandable. A condition added solely because it removes the worst historical Tuesday needs an independent reason and test. Calendar coincidences can look convincing after enough alternatives are tried.
Inspect the distribution of results. A method whose entire profit comes from one trade needs a different evaluation from a method with gains spread across several periods. Retain the exceptional trade, but show what the remaining sample contributes.
Changing the risk model can also fit history. If you raise size only before trades you now know were winners, the test uses future knowledge. Apply the sizing rule chronologically with the account information available at the time.
Forward testing observes the rule as new data arrives. Freeze the version before starting and compare its live decisions with the specification. A demo can reveal missing signals, order logic and connection problems, while its fills may differ from actual market execution.
Record signal time, order submission, acknowledgement and fill. If the backtest enters at the bar's close but the forward version submits after a noticeable delay, reconcile that difference. The two implementations should not silently share one performance label.
Use review conditions tied to implementation failures. A wrong quantity, missing protective order or duplicate entry can justify stopping the test immediately. A normal planned loss requires a record and comparison with the method's assumptions.
Free backtesting trading searches often focus on software price. Include the cost of usable historical data, account access and the time needed to verify the program. A free tool with unsuitable data can produce an expensive decision later.
Before allocating real funds, compare the frozen rules, recorded signals, realistic costs and adverse scenarios. If you change the method, assign a new version and a new forward evaluation. Keep the earlier result available for comparison.
Check the accounting with a tiny hand-calculated sample before trusting the report. For three trades with net cash results of +$20, −$10 and +$5, starting equity of $1,000 should end at $1,015 when there are no other cash flows. Reconcile the sequence, commission entries and open exposure. A mismatch at this scale can identify a fee or quantity error that becomes difficult to see in ten thousand trades.
Pending orders need historical state too. Suppose a limit expires after three bars, but the test continues checking whether price touched it for ten bars. The result can assign a winning fill to an order that should no longer exist. Record creation, modification, expiry and cancellation under the same event sequence used by the intended implementation.
Use the appropriate cash constraint. A simulation that spends settled cash twice before it becomes available can create a portfolio the real account could not hold. Margin, minimum quantity and currency conversion can impose similar constraints. Include these restrictions in the strategy backtesting specification and compare rejected signals with the submitted trade list.
These definitions describe the test's construction and output. Keep them attached to the data period, rule version and cost model so two reports remain comparable.
| Term | Meaning |
|---|---|
| Backtest | Historical simulation under stated rules and assumptions |
| Forward test | Observation of a fixed implementation as new data arrives |
| Overfitting | Selection that relies too heavily on sample-specific features |
| Profit factor | Gross winning amount divided by gross losing amount, on a stated basis |
| Look-ahead bias | Use of information unavailable at the simulated decision time |
Some tools and data are available without a subscription, with limits that vary by service. Establish the required history, resolution and execution assumptions first. Then compare the available options against those requirements.
Trade count alone is insufficient. Consider dependence between trades, different market conditions, selection and costs. A large sample of nearly identical overlapping trades can contain less information than its count suggests.
It improves the available price detail where the history is suitable. The test still needs correct rules, latency, fees and an appropriate fill model. Reconcile a small set of individual trades before running optimisation.
Save the rule version, program, configuration, data description, full trade list and assumptions. Preserve the untouched evaluation period before testing another variation.
Find Your Perfect Broker: Explore Our List Now!
Choose the best with our expert-selected options
Find Your Perfect Broker: Explore Our List Now!
Choose the best with our expert-selected options
Discover top binary options brokers tailored to your region. Browse our curated lists by country:
0