How to backtest a trading strategy

To backtest a trading strategy, write its rules so precisely that two people would take the same trades, apply them to past data bar by bar without looking ahead, and record every result with costs. Collect at least 100 trades across different market conditions, then test the results against your prop firm's drawdown rules, not only the profit.

Arnau Lavernia · Founder of Elave · Last updated:

What do I need before starting?

  • Written rules for entry, stop, target, trade management and filters (session, news, trend). If a rule needs judgement, write how you judge it.
  • One market and one session to start, for example NQ in the New York morning or EURUSD in London.
  • A test period long enough to include trending, ranging and volatile weeks, not only last month.
  • Cost assumptions per trade: spread, commission and slippage. Use your real broker's numbers.
  • A log with the same fields as your live journal, so backtest and live results can be compared.
  • A replay tool that hides future bars, or the discipline to scroll one bar at a time.

How do I backtest bar by bar without code?

  1. Pick a start date and hide everything to its right (a bar-replay tool does this for you).
  2. Step forward one bar at a time on your execution timeframe.
  3. When the rules trigger, write the entry, stop and target BEFORE you step further.
  4. Step until the stop, the target or your management rule closes the trade.
  5. Log the result in R and in money, minus costs, with the setup tag.
  6. Repeat until you have at least 100 trades, skipping no day you would have traded live.
  7. Summarise: expectancy, maximum drawdown, longest losing streak, results by session and weekday.

How many trades is enough?

At least 100 for a first verdict, and more before you compare sub-groups (sessions, setups). Small samples look convincing and are not: the table shows how wide the real range is around a 50% win rate.

How precise a 50% win rate is at each sample size (95% range, ±1.96 standard errors)
TradesWin rate could really beHow to read it
3032% to 68%Early signal only; do not change size on it
10040% to 60%Enough to compare against costs and drawdown
30044% to 56%Enough to compare sessions or setups with each other

Which biases ruin manual backtests?

  • Look-ahead: seeing the next candles before deciding. Hide the future, every time.
  • Cherry-picking: testing only the sessions or months you remember as good.
  • Rule drift: quietly changing the rules halfway through because a trade "obviously" should not count.
  • Ignoring costs: a strategy that makes 0.1R per trade before costs can lose money after them.
  • Overfitting: adding a filter after every losing trade until the past looks perfect. Each tweak tested on the same data makes the result less trustworthy.
  • Too few trades: see the table above.

How do I test against a prop firm's daily loss and drawdown?

Replay your backtest trades in order as if they were an evaluation. For every day, check whether the day's loss would have crossed the daily loss limit. Track the max-loss floor with the firm's drawdown type: static, end-of-day trailing or intraday trailing.

A strategy with a good average can still fail an evaluation if its worst week is deeper than the firm's maximum loss. Size from the drawdown first, then see whether the profit target is still reachable.

Backtest, forward test, live: when do I move on?

A backtest is a description of the past, not a forecast. After the backtest, forward-test the same written rules on a demo or simulated account for at least a few weeks. Compare the forward results to the backtest: if expectancy and drawdown are in the same range, move to live at a small size. If they are not, the backtest probably contained one of the biases above.

How do I read the results?

  • Expectancy after costs: positive, and large enough that a slightly worse fill does not erase it.
  • Maximum drawdown and the longest losing streak, compared with the account's maximum loss.
  • Results by session, weekday and month: an edge that lives in one slot is a smaller strategy, not a bad one.
  • A Monte Carlo reshuffle of trade order shows how deep drawdowns can get when the same trades come in a worse order.

Can I backtest with Elave?

For coded strategies, yes. Elave Backtest imports a TradingView Strategy Tester "List of trades" export and builds a report (seeded Monte Carlo, results by hour, weekday and month), saved in a library and kept apart from your live journal. It has no bar-by-bar replay. It is free with a signed-in account.

For bar-by-bar manual practice, use a replay tool; TradingView's Bar Replay, for example, simulates past price movement for strategy testing. Our comparison of backtesting software lists the main options, with each fact taken from the vendor's own page.

FAQ

Can I backtest a strategy without coding?

Yes. Manual backtesting with a bar-replay tool needs no code: you step through past bars, take trades by your written rules and log each result.

How many trades do I need in a backtest?

At least 100 for a first verdict. With 30 trades, a 50% win rate could really be anywhere from about 32% to 68%.

How far back should I backtest?

Far enough to include different conditions: trending, ranging and high-volatility periods. Months of only one regime tell you little about the next one.

Is a profitable backtest proof that a strategy works?

No. It shows the rules made money on past data. Forward testing on a demo account, with the same rules and costs, is the next check.

Does Elave have bar replay?

No. Elave's backtest feature imports TradingView Strategy Tester exports and builds a report; it has no bar-by-bar replay.

Keep going

Sources

Related

About Elave

Elave (elavefx.com) is a free trading platform for retail and prop-firm traders: an auto-synced trading journal, Guardian rule checks on MetaTrader 5, an AI Coach that reads your own trades, a report for TradingView Strategy Tester backtests, a Telegram trading desk and application-only coaching (Elave Bootcamp). The platform is free with no subscription and no card; Elave is funded by partner-broker (introducing-broker) relationships.

Create account · More prop-firm guides

Educational content, not investment advice. Elave makes no performance, win-rate, pass-rate or income claims. Trading leveraged products carries a high risk of loss.

We use cookies to keep you signed in and, with your OK, to measure and improve Elave. Cookie policy