Backtesting Guide By BitLogic Team Published 9 min read

Walk-Forward Testing and Out-of-Sample Testing Explained, With a No-Code Example for Stocks and Crypto

Optimize without curve-fitting, free: BitLogic Backtester on the Microsoft Store (Windows) runs walk-forward optimization on stocks and crypto with no code, and gives a plain-English "reality check" on unseen data. Your first optimization is free. See what it does.

Quick answer: out-of-sample testing means tuning a strategy on one part of your data and testing it on a later part it has never seen. Walk-forward testing repeats that in rolling rounds: optimize on a practice window, test on the window right after it, then move both forward. Judge the strategy only by the test windows. It is the most practical defence against overfitting, for a stock strategy on Apple as much as a crypto strategy on Bitcoin.

Written by the BitLogic Team, 27 November 2026. The example is a real optimization run in BitLogic Backtester in November 2026. This article is for education only and is not financial advice. Past results do not guarantee future returns.

Key Takeaways

What Are Walk-Forward and Out-of-Sample Testing?

Short answer: out-of-sample testing means tuning a strategy on one part of your data and testing it on a later part it has never seen. Walk-forward testing repeats that process in several rolling rounds: optimize on a practice window, test on the window right after it, then move both windows forward. The combined test results show how your strategy, and your way of optimizing it, would really have performed.

Why You Need Them

If you try 1,000 versions of a strategy and pick the best, that winner was chosen because it fitted the past best, partly by luck. Its backtest result is biased upward. The only fair test is data it played no part in choosing. It is like a student who memorized last year's exam answers: the real test is a new exam.

In-Sample vs Out-of-Sample

In-sample (practice)Out-of-sample (test)
Used forBuilding and optimizing rulesJudging the result
Results areOptimistic, by designAn honest estimate
Share of data70 to 80%20 to 30%
Change rules after?YesNo: once you tune on it, it becomes in-sample

How Walk-Forward Testing Works

Example with 7 years of daily data (November 2019 to November 2026) split into 4 back-to-back rounds, each about 15 months of practice followed by 6 months of test, roughly a 70/30 split:

RoundPractice (optimize)Test (unseen)
1Nov 2019 to Feb 2021Feb 2021 to Aug 2021
2Aug 2021 to Nov 2022Nov 2022 to May 2023
3May 2023 to Aug 2024Aug 2024 to Feb 2025
4Feb 2025 to May 2026May 2026 to Nov 2026

The settings that win round 4, chosen on the most recent data, are the most relevant ones to use today.

Rolling vs Anchored Walk-Forward

Example: Walk-Forward Optimization in BitLogic Backtester

We optimized the two Donchian channel lengths of the Turtle Breakout on Bitcoin (daily, 2019 to 2026), in 4 walk-forward rounds.

BitLogic Backtester walk-forward optimization results: passed the reality check, +21.2% average on unseen data, made money in 3 of 4 test periods, settings somewhat stable
Result: "Passed the reality check". Settings chosen on earlier data made money on later, unseen data in 3 of 4 rounds, averaging +21.2% per test period. In the practice periods where they were picked, the same settings averaged +125.9%.

How to read it:

How to Run a Walk-Forward Optimization Without Code

  1. Open a strategy with adjustable numbers (an RSI length, a moving-average period, a fixed stop or target %).
  2. Press Optimize and tick the numbers to test, with a range for each (for example EMA length 10 to 50 in steps of 5).
  3. Choose the search: "Test every combination" (most thorough) or "Smart search" (samples widely, then looks closer around the best).
  4. Set the rounds and split: for example 4 rounds, 70% practice / 30% test. The app warns you if test periods are too short to contain enough trades.
  5. Optionally add more symbols so settings must work on several stocks or coins at once, and a drawdown limit so it can't just pick the riskiest settings.
  6. Judge by the reality check, then run a normal backtest with the chosen settings and look at the Monte Carlo tab.

Walk-Forward Testing for Stocks vs Crypto

TopicStocksCrypto
Trading daysAbout 250 a year, so fewer candles per round365 a year, 24/7
HistoryDecades of daily data; intraday is short (1h about 2 years, 5m about 60 days)Since listing, with deep intraday history
Best candlesDaily or 1-hour for multi-round testsAnything from 15 minutes to daily
Getting tradesOptimize across a basket of similar stocksOptimize across several major coins
Regimes to includeA bear market such as 2008, 2020 or 2022Crashes such as 2018 or 2022

Because each test window must hold enough trades, rare-trading stock strategies benefit most from optimizing on several symbols at once. See how much data and how many trades you need.

BitLogic Backtester Test on many: Turtle Breakout made money on 9 of 10 symbols across 334 trades
Testing the same rules on 10 symbols gives far more trades per walk-forward round. It works with a list of coins or a list of stocks.

What a Good Walk-Forward Result Looks Like

Red Flags

Common Mistakes

After Walk-Forward: Paper Trading

Walk-forward testing uses history. The final out-of-sample test is the future: run the strategy on live prices with virtual money. BitLogic Backtester includes paper trading for stocks and crypto; read our guide to paper trading vs backtesting.

Optimize without curve-fitting, free: BitLogic Backtester for Windows runs walk-forward optimization across one or many symbols and candle sizes, with drawdown limits, liquidation modelling, fees and slippage, and a plain-English reality check. Stocks and crypto, no code. Your first optimization is free. Get it on the Microsoft Store.

BitLogic: Alerts for the Settings That Survive

BitLogic, our crypto screener for Windows, iPhone/iPad and Android, alerts you when indicator setups appear across the market. Use BitLogic Backtester to find settings that hold up out of sample, and BitLogic to watch for them. One account works in both, and paying BitLogic Pro members get the full BitLogic Backtester included.

FAQ

What is walk-forward testing?

Walk-forward testing optimizes a strategy on a practice window of data, tests the chosen settings on the window right after it, then moves both windows forward and repeats. The combined results of the test windows show how the strategy, and the way you optimize it, would really have performed.

What is out-of-sample testing?

Out-of-sample testing means building or tuning a strategy on one part of the data (in-sample) and judging it on a later part it has never seen (out-of-sample). Only the out-of-sample result is an honest estimate.

Is walk-forward testing the same as out-of-sample testing?

Walk-forward testing is out-of-sample testing repeated over several rolling windows, which gives more independent checks than one split.

What in-sample and out-of-sample split should I use?

A common choice is 70 to 80% in-sample and 20 to 30% out-of-sample in each round. Make sure every test period still contains enough trades to judge.

How many walk-forward rounds should I use?

Often 3 to 6. More rounds give more checks but shorter periods; make sure each test period still contains enough trades.

What is the difference between anchored and rolling walk-forward?

In rolling walk-forward the practice window keeps the same length and moves forward each round. In anchored walk-forward the practice window always starts at the beginning of the data and grows each round. Rolling adapts faster to changing markets; anchored uses more data.

Which settings should I use after a walk-forward test?

Usually those chosen in the most recent round, since they are based on the latest market behaviour. BitLogic Backtester suggests these with one click.

Does walk-forward testing guarantee the strategy will work?

No, but it is far more honest than a single optimized backtest. Follow it with paper trading on live prices.

Can I walk-forward test stock strategies?

Yes. In BitLogic Backtester it works the same for stocks and crypto. Intraday stock history is shorter, so use 1-hour or daily candles for long walk-forward tests on stocks.

The Bottom Line

An optimized backtest tells you how well settings fitted the past. A walk-forward test tells you how well your method of choosing settings works on the future. Keep the search small, make sure every test window holds enough trades, judge only the unseen periods, and paper trade what survives, whether it trades stocks or crypto.

Get the apps: BitLogic Backtester on the Microsoft Store (Windows; Mac, iPhone, iPad and Android coming soon) | BitLogic screener on the App Store, Google Play and the Microsoft Store

Related guides: Why a backtest wins but loses live | How much data and trades for backtesting | Paper trading vs backtesting | Stop-loss, take-profit and indicators | BitLogic Backtester

Nothing here is financial advice. BitLogic Backtester is an analysis tool: it does not place real trades. Past results do not guarantee future returns. Questions: backtester_support@bitlogic.info.