Backtesting a trading strategy, step by step
Before risking a cent, replay your strategy on historical data: backtest setup, reading the key metrics, and the traps of over-optimization.
A backtest replays a strategy on historical data to measure how it would have performed: how many trades, what win rate, what maximum loss along the way. It is the mandatory step between an idea and real money, not because the past guarantees the future, but because a strategy that cannot survive ten years of history has no reason to work tomorrow. This guide covers the full process in Screener.Trading, from settings to metrics, including the traps that make a backtest misleading.
Why backtest before risking anything
Without a backtest, you judge your strategy on impressions, and impressions remember the nice wins, not the long losing streaks. A backtest replaces feelings with numbers: it tells you whether a statistical edge exists, how large it is, and above all what you will have to endure to capture it. Knowing in advance that your strategy goes through 20% drawdowns changes everything: the day it happens live, it is an expected scenario, not a panic.
Setting up your backtest in Screener.Trading
A backtest is defined in two halves: how you enter, how you exit. Entries are driven by a screener : every time an asset meets its rules in the historical data, a position is opened. It is the same screener you use to scan the market live: you are testing exactly what you will trade.
- Entry: the screener of your choice (for example "close above the 200 SMA and RSI 14 below 40 on the daily").
- Exit: either a second screener (exit conditions become rules, like "RSI above 70"), or mechanical levels : stop loss %, take profit %, or a risk-reward ratio.
- Initial capital: the simulation's starting amount, used as the basis for the equity curve.
- Position size %: the share of capital committed to each trade : stay consistent with what you will do live.
- Fees: the percentage charged on each transaction. Never set them to zero: over dozens of trades, fees often turn a "winning" strategy into a losing one.
Start with a simple mechanical exit (stop loss and take profit %, or a 1:2 risk-reward ratio): it is easier to interpret than an exit screener, and it forces you to think in risk terms from the design stage.
Reading the results: the metrics that matter
Once the backtest has run, do not jump straight to total return: a strategy is judged on a set of metrics, never on a single number.
- Win rate: the share of winning trades. Read it alongside the average win / average loss ratio : a 40% win rate strategy can be very profitable if its wins are twice the size of its losses.
- Profit factor: total gains divided by total losses. Above 1 the strategy wins; below, it loses. A very high profit factor on few trades is suspicious : check it does not rest on one or two exceptional trades.
- Maximum drawdown: the worst decline of capital from a peak. It is the most concrete metric: ask yourself honestly whether you would keep applying the strategy after such a loss.
- Sharpe ratio: return relative to volatility. It lets you compare two strategies with equal returns : the one that shook the capital least wins.
- Buy & hold comparison: your strategy must beat (or at least rival, with less risk) simply buying the asset and holding it over the same period. Otherwise all that activity is pointless.
The traps that skew a backtest
A flattering backtest is easy to produce, and that is exactly the problem. Four traps explain most of the disillusionment between simulated results and reality:
- Over-optimization (curve fitting): tweaking parameters until the backtest looks perfect. An RSI at 37.5 instead of 40 because "it adds 3%" has captured nothing about the market : it has memorized the past. Prefer round, standard parameters, and distrust a strategy whose results collapse at the slightest settings change.
- Too short a period: two years of bull market test nothing. Cover several market regimes if possible (up, down, sideways) and require enough trades (a few dozen at minimum) for the statistics to mean anything.
- Ignoring fees: every round trip costs commission and spread. A strategy that trades often can see its entire edge absorbed by fees : always set them in the configuration.
- Survivorship bias: testing only on assets that still exist today overstates results : names that went bankrupt or left the index have vanished from the sample. Keep this bias in mind when interpreting historical performance on a present-day index.
Simulated performance is in no way indicative of future results. A backtest measures what a strategy would have done in the past, under idealized conditions : no slippage, no downtime, none of your emotions. Treat it as a filter to eliminate bad ideas, never as a promise of profits.
The next step: validate in paper trading
A convincing backtest is not a finish line, it is a ticket to the next step: paper trading. Run the strategy in live conditions with fictitious money for several weeks or months. You will confront the backtest's numbers with the living market (real-time signals, waiting, doubts) and you will find out whether you can apply the strategy with discipline. Only if the simulated results and the paper trading results tell the same story should the question of real money even come up.
Stop scrolling through charts for hours
Define your rules once : the screener watches the markets for you.
Join the waitlist for early access
Frequently asked questions
Keep exploring
- FeatureThe backtesting tool built into your screenersBacktests built from your screeners: entries, exits, fees and full metrics to judge a strategy on numbers instead of gut feeling.
- FeatureThe multi-indicator, multi-timeframe screenerCombine technical indicators, timeframes and comparison operators to keep only the assets that match your strategy exactly.
- FeaturePaper trading: learn in real conditions, without the riskPlace orders, manage positions and track your P&L on fully virtual accounts : real trading practice with zero real money at stake.
- IndicatorSimple Moving Average (SMA)The oldest and most widely used trend indicator: an average of recent closes that smooths out market noise and acts as a dynamic reference line.
- IndicatorRSI (Relative Strength Index)The most popular momentum oscillator: it bounds the strength of a move between 0 and 100 and flags overbought and oversold conditions.
- GlossaryWin rateThe win rate is the percentage of winning trades out of all trades of a strategy, to be interpreted together with the average win / average loss ratio.
- GlossaryProfit factorThe profit factor is the ratio of a strategy's gross profits to its gross losses: above 1, the strategy is profitable.
- GlossaryMaximum drawdownThe maximum drawdown is the largest decline suffered by the equity curve from a peak to the subsequent trough, expressed as a percentage of capital.
- GlossarySharpe ratioThe Sharpe ratio measures a strategy's risk-adjusted return, by dividing its excess performance by the volatility of its returns.
- GlossaryEquity curveThe equity curve plots the evolution of a strategy's capital trade after trade, and its shape often says more than any aggregate metric.
- GlossaryStop lossA stop loss is an automatic loss-taking exit level, set before entering a position, which caps each trade's risk at a predetermined amount.
- GlossaryTake profitA take profit is an automatic profit-taking exit level, set before entering a position, which locks in the gain when price reaches the intended target.
- GlossaryRisk/reward ratioThe risk/reward ratio compares a trade's targeted gain with its accepted loss, and together with the win rate determines whether a strategy has positive expectancy.
- GlossaryPosition sizingPosition sizing is the share of capital committed to a trade, calibrated so that the loss if the stop is hit remains a controlled fraction of the account.
- MarketThe stock screener: S&P 500, CAC 40, DAX 40 and FTSE 100Sift through major US and European stocks with composable technical rules across 18 timeframes, without writing a single line of code.
- MarketThe crypto screener across about 460 Binance pairsScan every Binance USDT pair with your own technical rules across 18 timeframes, and get alerted the moment a setup appears.
- GuideBuilding your first screener, step by stepHow to turn a strategy idea into objective rules, pick the right asset universe, read scan results and iterate until you get a genuinely actionable list of opportunities.
- GuideThe complete beginner's guide to tradingEverything you need to understand before placing your first order: reading a chart, choosing your style, using the right indicators, managing risk, and practicing without risking a cent.