← Strategy library

Testing a Strategy Before You Trade Itthe page that decides whether any of the others are worth anything

Evidence: ModerateBeginnerFoundations · Method

Every page in this library ends up in the same place: you have to find out whether it works on your instrument, your timeframe, your broker and your costs. Nobody else's result answers that.

The failure modes are well known and almost universal. A strategy tuned until it looks good on the data you tuned it on. A backtest that uses the day's high before the day is over. A cost assumption that quietly removes the spread. Each of these produces a beautiful curve and no money.

This page is the checklist. It is the most useful page in the book and the least exciting, which is the usual arrangement.

Category
Foundations · Method
Timeframe
Any
Minimum sample
Several hundred trades, and at least one period the strategy should have struggled in
Non-negotiable
Realistic spread, commission and slippage — from your own account's history
Tools
Your platform's tester · your own trade record · a written record of every parameter you tried

Valid setup

FD-10 · TESTING A STRATEGY — IN SAMPLE AND OUT the same rules either side of one line · the left half is where the parameters were chosen METHOD 96.7 101.8 106.9 112.1 117.2 122.3 127.5 IN SAMPLE — parameters chosen here, so this half proves nothing OUT OF SAMPLE — looked at ONCE start the number that gets screenshotted the number that matters 1 2 3 the split 100.0 124.0 114.0 ① A beautiful in-sample curve. Every overfitted strategy has one ② The split. Everything right of it was never used to choose anything ③ Costs applied from real statements, not assumed ④ The out-of-sample half is flatter. That is the honest estimate ⑤ Look at it once. A second look makes it in-sample ⑥ Then forward-test until you have seen it lose

Exact rules

Entry

  • Write the rules down completely before testing. If a rule needs your judgement at the time, it cannot be tested and what you are measuring is your memory.
  • Split the data: develop on one period, test once on another you have not looked at. Once. A second look at the held-out period makes it part of the development data.
  • Count every parameter you tried, including the ones you discarded. Twenty attempts on the same data will produce something that looks significant whether or not anything is there.
  • Include costs from your own statements — real spread at the hours you trade, real commission, and slippage measured from your own fills rather than assumed to be zero.

Stop loss

  • Look at the worst losing streak and the deepest drawdown, not at the total return. Those are the numbers that decide whether you will still be running the strategy when it recovers.
  • Check for look-ahead: does any rule use information from a bar that had not closed? This is the most common bug in retail backtests and it is invisible in the results, which look excellent.
  • Test at the size you will actually trade. A strategy that is fine at 0.5% and ruinous at 2% is two different strategies.

Take profit / exit

  • Forward-test on a demo or at minimum size for long enough to see the strategy lose. A strategy you have only seen win is a strategy you have not seen.
  • Compare the live result to the backtest regularly. Divergence is information — it usually means costs, or a rule that behaves differently in real time than in the tester.
  • Keep a decision log. In six months you will not remember why you chose 20 rather than 50, and that is exactly when you will be tempted to change it.

Build Testing a Strategy Before You Trade It

Reading this page is free and always will be. Taking it is what costs — the complete MQL5 for the rules above, yours to keep, permanently. Five of them cost $10 and they never expire.

More from Foundations

Trading carries risk and most retail accounts lose money. Nothing on this page is financial advice or a recommendation to trade. The chart is an illustration of the rules on constructed candles — it is not a record of a trade and not a backtest.