Backtesting and Forward-Testing a Strategy

Advanced · Advanced Path, lesson 10 of 12 · Trading · 7 min read · Published 19 Oct 2026 · Updated 19 Oct 2026

How to test a trading strategy before real money is at stake: write testable rules, backtest on past charts, measure expectancy after costs, and forward-test on demo first.

Every strategy starts as an idea, and most ideas sound convincing until they meet real prices. Backtesting applies a strategy's written rules to past price data to see how it would have performed. Forward-testing applies the same rules to new prices as they arrive, on a demo account or with very small size, where hindsight cannot help you. Together they answer two questions: did this idea have an edge, and can you actually trade it?

This lesson walks through both, from writing rules that can be tested to measuring results after costs and spotting the traps that make a backtest look better than reality. All numbers are illustrative. A test describes the past under your assumptions; it does not predict what comes next.

Open a trade on Traders Portal

Two tests, two questions

Backtesting and forward-testing compared
BacktestingForward-testing
DataPast pricesNew prices, in real time
Question it answersDid the rules have an edge before?Does the edge hold, and can I execute it?
SpeedMonths of data in hoursAs slow as the market
Main weaknessHindsight and overfittingTakes time; small samples at first
WhereCharts, spreadsheets, codeA demo account, then small live size

Step 1: Write rules that can be tested

Vague rules ("buy strong breakouts") let you judge each trade with hindsight. Testable rules leave nothing to interpret. Here is an illustrative example:

  • Market and timeframe: BTC/USDT, 4h candles.
  • Entry: buy when a candle closes above the highest high of the previous 20 candles.
  • Stop: just below the lowest low of the last 5 candles.
  • Exit: take profit at 2R, where 1R is the distance from entry to stop.
  • Size: risk 1% of equity per trade, one open trade at a time.
  • Filter: no new trades within 24 hours of a high-impact economic event.

Each rule should be specific enough that two people testing it would record the same trades. The breakout vs mean reversion lesson has more ideas you could turn into rules.

Step 2: Run the backtest

A manual backtest means scrolling back through history, hiding the candles to the right, and stepping forward one candle at a time. Each time the rules fire, you record the date, direction, entry, stop, target, exit and the result in R in a spreadsheet. It is slow, but it teaches you how the strategy feels.

An automated backtest runs the rules in code or a spreadsheet over downloaded price data. It is much faster and can test thousands of trades, but a single coding mistake can quietly produce wonderful, false results.

On Traders Portal, the trade chart offers 1m, 5m, 15m, 1h, 4h and 1D timeframes, and you can scroll back through history, then use the Back to latest pill to return. The trade chart has no indicators or drawing tools, so rules that rely on them are usually tested in a separate charting tool.

Aim for a sample that covers different conditions: trends, ranges, quiet and volatile periods. Many traders want at least 100 trades before they trust the numbers.

Step 3: Measure what matters

Also record the maximum drawdown and the longest losing streak: they tell you what living with the strategy will feel like. Drawdown, expectancy and Kelly explains how these numbers feed into how much to risk.

The traps that flatter a backtest

  • Overfitting. Tuning many settings until the past looks perfect. Keep rules few and round, and check the result on a stretch of data you did not use to build them.
  • Look-ahead bias. Using information you would not have had at the time, such as a candle's close before it closed, or a level only obvious afterwards.
  • Survivorship bias. Testing only on markets that are still around or did well, which quietly removes the failures.
  • Missing costs. Leaving out the spread, the trade fee (the fee shown in the order panel before you confirm), swap on positions held past the daily swap time shown in the market details, and slippage when a stop fills at market.
  • One kind of market. A strategy tested only in a strong trend says little about how it handles a range.
  • Different data. CFD prices follow a reference price plus a spread, so they can differ slightly from exchange data you tested on.

Step 4: Forward-test on demo, then small live

A demo account lets you run the strategy in real time on a virtual balance instead of real money. On desktop, you can request one with the Demo button in the top bar.

  1. Freeze the rules

    Label them, for example "v1.0", and do not change them during the test. Any change starts a new test.

  2. Set the pass mark in advance

    Decide the number of trades and the criteria now: for example, 40 trades, expectancy above zero after costs, and no drawdown worse than 10R.

  3. Trade and log everything

    Place every signal the rules give, with the planned TP / SL, and note any you skipped and why. Skipped signals are data too.

  4. Compare with the backtest

    Use Net PnL, Fees, Swap and Reason in Closed Positions, and the win ratio, average profit and average loss on the Portfolio page, to see whether the numbers sit in the same range.

  5. Go live small

    If the results hold, trade the same rules live at a fraction of your intended size. Real money changes how you execute, and that needs testing too.

Reading the results honestly

If the forward test roughly matches the backtest, you have some evidence that the edge was real and that you can execute it. If it is much worse, first check whether you followed the rules; execution gaps are common. If you did follow them, the backtest may have been overfitted, or market conditions may have changed. Dropping a strategy that fails its test is a success of the process, not a failure.

Conclusion

Backtesting tells you whether written rules had an edge on past data; forward-testing tells you whether that edge survives fresh prices and your own execution. Write rules a stranger could follow, measure expectancy in R after costs, watch for the biases that flatter results, and forward-test on demo and then at small size before committing more. Even then, treat any edge as something to monitor, not something you own.

Related reading

  1. Scaling In/Out, Trailing Stops and Partial Take-Profit
  2. Scalping vs Day Trading vs Swing Trading
  3. Breakout vs Mean Reversion Strategies
  4. Smart Money Concepts: Liquidity, Order Blocks, Fair Value Gaps
  5. Price Action Trading Without Indicators

FAQs

What is the difference between backtesting and forward-testing?
Backtesting applies a strategy's written rules to past price data to see how it would have done. Forward-testing applies the same rules to new prices as they arrive, on a demo account or with very small size, so hindsight cannot creep in.
How many trades do I need for a meaningful test?
There is no magic number, but a few dozen trades can easily be skewed by luck. Many traders aim for at least 100 backtested trades across different market conditions, then a further 30 to 50 forward-tested trades.
What is overfitting?
Overfitting means tuning a strategy's settings until they match past data almost perfectly. The result usually reflects the quirks of that period rather than a real edge, and it tends to perform much worse on new data.
Does a profitable backtest mean the strategy will make money?
No. A backtest shows how the rules behaved on past data under your assumptions. Markets change, costs and slippage can be higher than expected, and trading real money feels different, so results going forward can be much worse.
Can I backtest on the Traders Portal chart?
You can scroll back through price history on the trade chart and step through it manually. The trade chart has no indicators or drawing tools, so rules that need them are usually tested in a separate charting tool.

Topics: Trading Strategies