How to Backtest a Trading Strategy (Step by Step)

By Mohamed Amine Sououdi, Founder · 6 min read

Backtesting means running your trading rules over historical price data to see how they would have performed. Done honestly, it turns a hunch into evidence. Done carelessly, it produces a beautiful equity curve that falls apart the moment you trade it live.

Step 1: write your rules as if a robot must follow them

Every entry, exit, stop and target must be a precise, testable condition — not ‘when it looks good.’ Define the timeframe, the session, the exact setup, how the stop is placed, and the reward-to-risk. If you cannot state a rule clearly enough for a machine, you cannot backtest it, and you probably cannot repeat it live either.

Step 2: use enough clean data

Test across many years and many market conditions — trending, ranging, high and low volatility. A strategy that only worked in one regime will fail when the regime changes. More history means more trades, and more trades means a result you can actually trust.

Step 3: avoid look-ahead bias

The most common way backtests lie is by using information that would not have existed at the moment of the trade — acting on a candle before it closed, or on data released later. A trustworthy backtest acts only on what was known at that bar, and fills orders at realistic prices with slippage.

Step 4: check it out of sample

Split your history: build and tune on the older part, then test on a recent part the strategy has never seen. If the edge survives on unseen data, it is more likely real. If it collapses, you fit the past, not the future — the classic sign of overfitting.

Backtest your own strategy in NEXALIONE

Bulk Quant lets you describe your strategy in plain questions and tests your exact rules over 20+ years, on any timeframe, year by year — with no look-ahead and a built-in out-of-sample check. It is rule-based, so it cannot flatter you. Start free.

Track this automatically with NEXALIONE

Auto-sync your broker, and your profit factor, expectancy and win rate compute themselves — with an AI coach on your own setups. Free to start.

Start free

Keep reading