Skip to content

Backtesting & Strategy Development

How to Backtest a Trading Strategy

To backtest a trading strategy, define your rules precisely, obtain clean historical data, simulate entries and exits with realistic costs, and evaluate results on both in-sample and reserved out-of-sample periods.

What Is the Step-by-Step Backtesting Workflow?

One: finalize written strategy rules and version number. Two: select universe and date range; hold out recent months as out-of-sample. Three: configure data—bar size, adjustments, session hours. Four: implement rules in backtest platform or script; verify signals on a few charts manually. Five: run in-sample with fixed parameters—no tuning yet. Six: review trade list and metrics; fix bugs before optimizing. Seven: run out-of-sample once with same parameters. Eight: document results and decision to paper trade, revise, or abandon. Skipping manual verification causes costly false confidence.

Block calendar time for steps four and six—rushing to equity curves is how bad strategies get funded.

How Do You Model Fills and Costs Realistically?

Day trades: assume fill worse than ideal—next bar open, or signal price plus one tick slippage. Stops may slip on gaps through level. Commissions per share add up on high-frequency systems. Partial fills on size may matter on mid caps. Swing trades: use close or next open consistently; model wider slippage on illiquid names. Shorts need borrow availability assumptions—exclude hard-to-borrow symbols if your broker often denies locates. If backtest uses mid-price fills but you pay spread, live results will disappoint.

Stress-test with double your estimated slippage—strategies that die under stress were never robust.

How Should You Split In-Sample and Out-of-Sample Data?

In-sample period develops and debugs the strategy—may include one round of parameter choice from a small grid. Out-of-sample period tests frozen rules without further changes. Typical split: seventy to eighty percent in-sample, twenty to thirty percent out-of-sample by time. Walk-forward analysis extends this: optimize on window one, test on window two, roll forward. Never peek at out-of-sample repeatedly while tweaking—that contaminates it. One honest out-of-sample fail saves months of live losses.

Label out-of-sample dates in your journal and resist reopening them after a disappointing in-sample tweak.

What Validation Checks Catch Common Bugs?

Look-ahead: signals should use only prior and current bar data as defined. Survivorship bias: universe should include delisted stocks if your live universe could have held them. Corporate actions: splits adjust historical prices. Timezone and session: day strategies exclude after-hours unless intended. Duplicate signals on same bar. Position sizing rounding to whole shares. Run sensitivity: change slippage plus fifty percent—if edge vanishes, edge was thin. Compare trade count to manual spot checks on random weeks.

Chart ten losing trades—if stops look impossible to fill at modeled price, fix the engine before scaling.

When Are Backtest Results Good Enough for Paper Trading?

Minimum trade count—often fifty or more in-sample plus twenty out-of-sample. Profit factor and Sharpe acceptable to your standards. Drawdown within risk tolerance. Logic matches how you will actually trade—no rules you will ignore live. Out-of-sample not catastrophic versus in-sample. Team or mentor review if available. Then paper trade thirty sessions with execution log comparing to backtest assumptions. Backtest approval is gate one, not final approval.

Paper trading should log missed fills and skipped signals—live friction often explains backtest gaps.

See It In Action

Trade Ideas scans 8,000+ stocks in real time. Try the platform that puts this into practice.

Try Trade Ideas Free