Skip to content

Rolling optimization: walk-forward portfolio backtest

Rolling (walk-forward) optimization re-estimates a portfolio’s optimal weights at each rebalance date using only a trailing window of past data, holds them until the next date and repeats, so its track record contains no look-ahead and measures how an optimisation method performs out of sample. This free tool runs it on real monthly ETF returns for maximum Sharpe, minimum volatility and risk parity, against equal weights and the optimum picked with hindsight. No sign-up.

Data updated November 13, 2026

Short answer. Rolling (walk-forward) optimisation re-optimises a portfolio at each rebalance date using only a trailing window of past data and holds the weights until the next date, so every month of the result is out of sample. For SPY, EFA, AGG, TLT and GLD, with a 60-month window, quarterly rebalancing and 10 basis points per trade, maximum-Sharpe weights had an average Sharpe ratio of 1.33 on the windows they were chosen from and delivered 0.69 from Jun 2012 to Oct 2026. Equal weights, rebalanced on the same dates, delivered 0.62, and the single maximum-Sharpe mix picked with hindsight (79% SPY and 21% GLD) 1.00. Minimum volatility went from 0.75 in-sample to 0.16 out of sample, and risk parity from 0.84 to 0.55.

Max Sharpe: Sharpe in-sample
1.33
Max Sharpe: Sharpe out-of-sample
0.69
Equal weight: Sharpe
0.62
Max Sharpe with hindsight
1.00
Max Sharpe: return a year
+7.9%
Max Sharpe: turnover a year
53%
Min volatility: in / out Sharpe
0.75 / 0.16
Risk parity: in / out Sharpe
0.84 / 0.55

Monthly total returns with dividends reinvested; first data month Jun 2007, test Jun 2012 to Oct 2026 (173 months; prices to November 13, 2026). 60-month window, quarterly rebalancing, 10 bps per trade, weights 0–100%. Sharpe ratios on excess returns over 1–3 month US Treasury bills (BIL). Historical test, not a forecast or a recommendation.

1 · Funds and weight limits

2 · Objective, re-optimised at every rebalance 

3 · Window, rebalancing and costs

Estimation window (months) 
Rebalance 
Trading cost (bps) 
The honest test of optimisation. Every month from Jun 2012 to Oct 2026 was held with weights chosen using only the 60 months before the decision, re-optimised every quarter. Compare what the optimiser promised on its windows with what it delivered afterwards.

Sharpe, out-of-sample 

0.69

Walk-forward, realised

Sharpe, in-sample 

1.33

Average over the windows

Gap (in − out) 

0.64

Promised but not delivered

Equal weight Sharpe 

0.62

Hindsight optimum: 1.00

Test period Jun 2012 to Oct 2026 (173 months, after the first 60-month window from Jun 2007); 59 optimisations.

Walk-forward optimisation compared with equal weights and with the optimum chosen with hindsight, over the same months
Walk-forward Max Sharpeout-of-sampleEqual weight (1/N)same scheduleMax Sharpe with hindsight in-sample
Return a year (CAGR) +7.9%+6.7%+13.4%
$10,000 became$29,803$25,446$61,451
Volatility 9.4%8.4%11.7%
Sharpe ratio, realised 0.690.621.00
Sharpe ratio, in-sample promise 1.33—0.99
Max drawdown −23.7%−21.1%−21.0%
Turnover a year 53%8%5%
Cost drag 0.11%0.02%0.01%

All three are rebalanced on the same dates and pay the same cost on the value bought and sold. The hindsight column holds one fixed mix (79.3% SPY, 20.7% GLD) chosen by looking at every month of the test: nobody could have held it, so read it as an upper reference. Sharpe ratios use US Treasury bills (BIL) .

Growth of $10,000, out of sample

$0$20k$40k$60k$80k2014201620182020202220242026
Walk-forward Max Sharpe (out-of-sample)Equal weight 1/NHindsight optimum (in-sample)

How the weights changed

Weights held at the start of each month, after any rebalance. Between rebalances they drift with prices. Hover for the month.

Jun 2012: AGG 86.2%, TLT 1.4%, GLD 12.4%Jul 2012: AGG 87.7%, GLD 12.3%Aug 2012: AGG 87.7%, GLD 12.3%Sep 2012: AGG 87.2%, GLD 12.8%Oct 2012: AGG 88.2%, GLD 11.8%Nov 2012: AGG 88.5%, GLD 11.5%Dec 2012: AGG 88.6%, GLD 11.4%Jan 2013: AGG 91.9%, GLD 8.1%Feb 2013: AGG 91.9%, GLD 8.1%Mar 2013: AGG 92.3%, GLD 7.7%Apr 2013: SPY 4.1%, AGG 90.0%, GLD 5.8%May 2013: SPY 4.2%, AGG 90.5%, GLD 5.3%Jun 2013: SPY 4.4%, AGG 90.5%, GLD 5.1%Jul 2013: SPY 7.5%, AGG 92.5%Aug 2013: SPY 7.8%, AGG 92.2%Sep 2013: SPY 7.7%, AGG 92.3%Oct 2013: SPY 10.9%, AGG 89.1%Nov 2013: SPY 11.3%, AGG 88.7%Dec 2013: SPY 11.6%, AGG 88.4%Jan 2014: SPY 16.7%, AGG 82.7%, GLD 0.6%Feb 2014: SPY 16.0%, AGG 83.4%, GLD 0.6%Mar 2014: SPY 16.6%, AGG 82.8%, GLD 0.6%Apr 2014: SPY 26.7%, AGG 61.0%, TLT 12.3%May 2014: SPY 26.7%, AGG 60.8%, TLT 12.5%Jun 2014: SPY 26.8%, AGG 60.5%, TLT 12.6%Jul 2014: SPY 29.2%, AGG 54.8%, TLT 16.0%Aug 2014: SPY 29.0%, AGG 54.9%, TLT 16.2%Sep 2014: SPY 29.4%, AGG 54.1%, TLT 16.5%Oct 2014: SPY 29.9%, AGG 53.8%, TLT 16.3%Nov 2014: SPY 30.1%, AGG 53.4%, TLT 16.5%Dec 2014: SPY 30.4%, AGG 52.9%, TLT 16.7%Jan 2015: SPY 34.1%, AGG 40.6%, TLT 25.3%Feb 2015: SPY 32.4%, AGG 40.5%, TLT 27.2%Mar 2015: SPY 34.3%, AGG 40.2%, TLT 25.6%Apr 2015: SPY 41.6%, AGG 26.1%, TLT 32.3%May 2015: SPY 42.4%, AGG 26.2%, TLT 31.4%Jun 2015: SPY 43.1%, AGG 26.2%, TLT 30.8%Jul 2015: SPY 59.9%, TLT 40.1%Aug 2015: SPY 59.4%, TLT 40.6%Sep 2015: SPY 58.0%, TLT 42.0%Oct 2015: SPY 48.0%, AGG 23.3%, TLT 28.7%Nov 2015: SPY 50.1%, AGG 22.5%, TLT 27.5%Dec 2015: SPY 50.3%, AGG 22.4%, TLT 27.3%Jan 2016: SPY 44.7%, AGG 25.6%, TLT 29.7%Feb 2016: SPY 42.6%, AGG 26.0%, TLT 31.5%Mar 2016: SPY 42.1%, AGG 25.9%, TLT 32.1%Apr 2016: SPY 33.4%, AGG 44.0%, TLT 22.6%May 2016: SPY 33.5%, AGG 44.1%, TLT 22.5%Jun 2016: SPY 33.8%, AGG 43.7%, TLT 22.5%Jul 2016: SPY 43.3%, AGG 23.6%, TLT 33.1%Aug 2016: SPY 43.8%, AGG 23.2%, TLT 33.0%Sep 2016: SPY 44.0%, AGG 23.2%, TLT 32.8%Oct 2016: SPY 34.0%, AGG 54.4%, TLT 11.6%Nov 2016: SPY 34.0%, AGG 54.8%, TLT 11.3%Dec 2016: SPY 35.6%, AGG 53.9%, TLT 10.5%Jan 2017: SPY 35.6%, AGG 62.3%, TLT 2.1%Feb 2017: SPY 35.9%, AGG 62.0%, TLT 2.1%Mar 2017: SPY 36.7%, AGG 61.2%, TLT 2.1%Apr 2017: SPY 42.5%, AGG 46.3%, TLT 11.1%May 2017: SPY 42.5%, AGG 46.3%, TLT 11.2%Jun 2017: SPY 42.6%, AGG 46.1%, TLT 11.3%Jul 2017: SPY 38.2%, AGG 61.8%Aug 2017: SPY 38.6%, AGG 61.4%Sep 2017: SPY 38.4%, AGG 61.6%Oct 2017: SPY 40.7%, AGG 58.7%, TLT 0.6%Nov 2017: SPY 41.3%, AGG 58.1%, TLT 0.6%Dec 2017: SPY 42.0%, AGG 57.4%, TLT 0.6%Jan 2018: SPY 68.0%, AGG 9.0%, TLT 23.0%Feb 2018: SPY 69.7%, AGG 8.7%, TLT 21.6%Mar 2018: SPY 69.5%, AGG 8.9%, TLT 21.7%Apr 2018: SPY 72.4%, TLT 27.6%May 2018: SPY 72.9%, TLT 27.1%Jun 2018: SPY 73.0%, TLT 27.0%Jul 2018: SPY 56.8%, AGG 20.2%, TLT 23.0%Aug 2018: SPY 57.8%, AGG 19.9%, TLT 22.3%Sep 2018: SPY 58.4%, AGG 19.5%, TLT 22.1%Oct 2018: SPY 64.9%, AGG 7.7%, TLT 27.4%Nov 2018: SPY 63.8%, AGG 8.0%, TLT 28.1%Dec 2018: SPY 63.9%, AGG 8.0%, TLT 28.2%Jan 2019: SPY 25.2%, AGG 70.1%, TLT 4.7%Feb 2019: SPY 26.5%, AGG 68.9%, TLT 4.6%Mar 2019: SPY 27.2%, AGG 68.4%, TLT 4.5%Apr 2019: SPY 25.2%, AGG 74.8%May 2019: SPY 26.0%, AGG 74.0%Jun 2019: SPY 24.4%, AGG 75.6%Jul 2019: SPY 22.5%, AGG 77.5%Aug 2019: SPY 22.7%, AGG 77.3%Sep 2019: SPY 21.9%, AGG 78.1%Oct 2019: SPY 22.3%, AGG 77.7%Nov 2019: SPY 22.7%, AGG 77.3%Dec 2019: SPY 23.3%, AGG 76.7%Jan 2020: SPY 25.5%, AGG 73.4%, GLD 1.0%Feb 2020: SPY 25.1%, AGG 73.8%, GLD 1.1%Mar 2020: SPY 23.4%, AGG 75.6%, GLD 1.1%Apr 2020: SPY 34.1%, AGG 26.0%, TLT 36.2%, GLD 3.7%May 2020: SPY 36.4%, AGG 25.1%, TLT 34.7%, GLD 3.8%Jun 2020: SPY 37.7%, AGG 24.9%, TLT 33.6%, GLD 3.8%Jul 2020: SPY 30.7%, AGG 33.2%, TLT 34.2%, GLD 1.9%Aug 2020: SPY 31.3%, AGG 32.4%, TLT 34.3%, GLD 2.0%Sep 2020: SPY 33.4%, AGG 32.1%, TLT 32.5%, GLD 2.0%Oct 2020: SPY 47.8%, TLT 51.3%, GLD 0.9%Nov 2020: SPY 48.0%, TLT 51.1%, GLD 0.9%Dec 2020: SPY 50.2%, TLT 49.0%, GLD 0.8%Jan 2021: SPY 30.9%, AGG 39.1%, TLT 20.7%, GLD 9.3%Feb 2021: SPY 31.1%, AGG 39.5%, TLT 20.2%, GLD 9.2%Mar 2021: SPY 32.5%, AGG 39.4%, TLT 19.4%, GLD 8.7%Apr 2021: SPY 36.9%, AGG 52.6%, TLT 9.9%, GLD 0.6%May 2021: SPY 37.8%, AGG 51.6%, TLT 9.9%, GLD 0.7%Jun 2021: SPY 37.9%, AGG 51.5%, TLT 9.8%, GLD 0.7%Jul 2021: SPY 49.5%, AGG 27.8%, TLT 22.4%, GLD 0.3%Aug 2021: SPY 49.6%, AGG 27.5%, TLT 22.7%, GLD 0.3%Sep 2021: SPY 50.4%, AGG 27.1%, TLT 22.3%, GLD 0.3%Oct 2021: SPY 62.7%, TLT 35.8%, GLD 1.4%Nov 2021: SPY 63.7%, TLT 34.9%, GLD 1.4%Dec 2021: SPY 63.0%, TLT 35.7%, GLD 1.4%Jan 2022: SPY 49.1%, TLT 40.9%, GLD 10.0%Feb 2022: SPY 48.7%, TLT 41.1%, GLD 10.3%Mar 2022: SPY 47.9%, TLT 41.0%, GLD 11.1%Apr 2022: SPY 49.4%, TLT 27.7%, GLD 22.9%May 2022: SPY 48.7%, TLT 27.1%, GLD 24.2%Jun 2022: SPY 49.4%, TLT 26.9%, GLD 23.7%Jul 2022: SPY 50.3%, GLD 49.7%Aug 2022: SPY 53.2%, GLD 46.8%Sep 2022: SPY 52.9%, GLD 47.1%Oct 2022: SPY 55.5%, GLD 44.5%Nov 2022: SPY 57.9%, GLD 42.1%Dec 2022: SPY 57.2%, GLD 42.8%Jan 2023: SPY 46.1%, GLD 53.9%Feb 2023: SPY 46.2%, GLD 53.8%Mar 2023: SPY 47.0%, GLD 53.0%Apr 2023: SPY 48.5%, GLD 51.5%May 2023: SPY 48.7%, GLD 51.3%Jun 2023: SPY 49.1%, GLD 50.9%Jul 2023: SPY 48.1%, GLD 51.9%Aug 2023: SPY 48.4%, GLD 51.6%Sep 2023: SPY 48.3%, GLD 51.7%Oct 2023: SPY 39.9%, GLD 60.1%Nov 2023: SPY 37.7%, GLD 62.3%Dec 2023: SPY 39.1%, GLD 60.9%Jan 2024: SPY 56.3%, GLD 43.7%Feb 2024: SPY 57.1%, GLD 42.9%Mar 2024: SPY 58.2%, GLD 41.8%Apr 2024: SPY 50.4%, GLD 49.6%May 2024: SPY 48.6%, GLD 51.4%Jun 2024: SPY 49.5%, GLD 50.5%Jul 2024: SPY 53.9%, GLD 46.1%Aug 2024: SPY 52.9%, GLD 47.1%Sep 2024: SPY 53.0%, GLD 47.0%Oct 2024: SPY 48.8%, GLD 51.2%Nov 2024: SPY 47.6%, GLD 52.4%Dec 2024: SPY 49.8%, GLD 50.2%Jan 2025: SPY 47.4%, GLD 52.6%Feb 2025: SPY 46.5%, GLD 53.5%Mar 2025: SPY 45.7%, GLD 54.3%Apr 2025: SPY 52.2%, GLD 47.8%May 2025: SPY 50.7%, GLD 49.3%Jun 2025: SPY 52.2%, GLD 47.8%Jul 2025: SPY 53.2%, GLD 46.8%Aug 2025: SPY 53.9%, GLD 46.1%Sep 2025: SPY 53.2%, GLD 46.8%Oct 2025: SPY 49.0%, GLD 51.0%Nov 2025: SPY 48.7%, GLD 51.3%Dec 2025: SPY 47.4%, GLD 52.6%Jan 2026: SPY 40.5%, GLD 59.5%Feb 2026: SPY 38.1%, GLD 61.9%Mar 2026: SPY 35.9%, GLD 64.1%Apr 2026: SPY 29.1%, GLD 70.9%May 2026: SPY 31.6%, GLD 68.4%Jun 2026: SPY 33.0%, GLD 67.0%Jul 2026: SPY 41.7%, GLD 58.3%Aug 2026: SPY 41.5%, GLD 58.5%Sep 2026: SPY 39.9%, GLD 60.1%Oct 2026: SPY 43.7%, GLD 56.3%

The bands add up to 100% each month.

SPYEFAAGGTLTGLD

Average one-way turnover per rebalance: 13.2%; 53% a year, which at the cost you set took 0.11% a year from the return.

Each optimisation

Newest first. The in-sample Sharpe is what the chosen weights achieved on the window they were chosen from.

Held fromSPYEFAAGGTLTGLDIn-sample Sharpe Turnover 
Oct 2026window to Sep 202643.7%0.0%0.0%0.0%56.3%1.022.2%
Jul 2026window to Jun 202641.7%0.0%0.0%0.0%58.3%1.006.1%
Apr 2026window to Mar 202629.1%0.0%0.0%0.0%70.9%1.208.3%
Jan 2026window to Dec 202540.5%0.0%0.0%0.0%59.5%1.186.4%
Oct 2025window to Sep 202549.0%0.0%0.0%0.0%51.0%1.152.4%
Jul 2025window to Jun 202553.2%0.0%0.0%0.0%46.8%1.060.2%
Apr 2025window to Mar 202552.2%0.0%0.0%0.0%47.8%1.1410.2%
Jan 2025window to Dec 202447.4%0.0%0.0%0.0%52.6%0.862.1%
Oct 2024window to Sep 202448.8%0.0%0.0%0.0%51.2%0.953.4%
Jul 2024window to Jun 202453.9%0.0%0.0%0.0%46.1%0.873.5%
Apr 2024window to Mar 202450.4%0.0%0.0%0.0%49.6%0.896.6%
Jan 2024window to Dec 202356.3%0.0%0.0%0.0%43.7%0.8816.4%
Same funds in the optimizer

Monthly total returns with dividends reinvested, complete months only; the funds’ own costs are included, taxes are not. Each set of weights uses only data available at the end of the month before it is held. A historical test, not a forecast and not investment advice.

Four objectives, walk-forward on the same months

Each objective re-optimised on the trailing 60 months, quarterly, with 10 bps per trade and weights between 0% and 100%, on SPY, EFA, AGG, TLT and GLD over the same months, Jun 2012 to Oct 2026. The tool above reproduces any row.

Walk-forward results of four optimisation objectives over the same months
ObjectiveSharpe in-sampleSharpe out-of-sampleGapReturn a yearVolatilityMax drawdownTurnover a yearSharpe with hindsight
Maximum Sharpe ratio1.330.690.64+7.9%9.4%−23.7%53%1.00
Minimum volatility0.750.160.59+2.3%4.7%−16.6%4%0.04
Risk parity (equal risk contribution)0.840.550.29+5.5%7.3%−19.8%9%0.55
Equal weight0.720.620.10+6.7%8.4%−21.1%8%0.62

In-sample: the average Sharpe ratio each set of weights had on its own window. Out-of-sample: the realised Sharpe ratio of the walk-forward portfolio, net of costs. Gap = in − out. The equal-weight row rebalances to 1/N on the same dates (Sharpe 0.62, return +6.7% a year); its in-sample figure is simply how 1/N did on each trailing window. With hindsight: one fixed mix optimised on all the test months.

What is rolling (walk-forward) optimization?

A portfolio optimiser turns estimates of returns, volatilities and correlations into weights. Run once on all the data you have, it answers a question about the past: which mix would have done best over those years. Rolling optimisation asks the question an investor actually faces: if I had used this method, with the data available at each point, what would I have earned?

The procedure is mechanical. Pick an estimation window, say 60 months. At the first rebalance date, optimise on the 60 months that end there and buy the result. Hold it, letting the weights drift with prices, until the next rebalance date; then move the window forward, optimise again and trade to the new weights, paying costs on what changes. Chaining the months held produces an equity curve in which every return was earned with weights decided beforehand. The method behind the weights is the same as in the portfolio optimizer: mean-variance in the tradition of Markowitz [1], minimum volatility and risk parity [6].

The term walk-forward comes from the testing of trading systems, where a rule’s parameters are re-fitted on each window and judged on the next. Applied to allocation, the parameters are the weights themselves.

Why walk-forward is the honest test of optimisation

Optimised portfolios usually look excellent on the data they were optimised on, by construction: the optimiser searched every mix and kept the one that scored best on those months, including on their noise. Average returns are the noisiest input; Chopra and Ziemba found errors in expected returns about ten times as damaging as errors in variances [4], and Michaud called mean-variance optimisers “estimation-error maximizers” [3].

A single split into a fitting half and a test half, as in our optimiser, already exposes this. Walk-forward goes further: it re-fits many times, so the result does not hinge on one split, and it includes what re-fitting costs, the turnover from weights that chase the latest window. On the default funds, maximum-Sharpe weights promised an average Sharpe ratio of 1.33 on their windows and delivered 0.69; with hindsight the best fixed mix reached 1.00, and plain equal weights 0.62.

The benchmark that matters is equal weight. DeMiguel, Garlappi and Uppal tested 14 optimisation models on seven datasets with rolling estimation windows and found none that consistently beat the 1/N portfolio out of sample on Sharpe ratio, certainty-equivalent return or turnover [2]. They estimated that sample-based mean-variance would need around 3,000 months of data with 25 assets to beat it reliably. If a method cannot beat 1/N in your walk-forward test, the optimisation is adding trading and complexity without evidence of value.

A walk-forward test is not immune to over-fitting either. Trying many windows, frequencies and fund lists and keeping the best one fits the test itself; Bailey, Borwein, López de Prado and Zhu show how quickly the best of many backtests stops meaning anything [7]. Decide the settings first, then run the test.

How the backtest works

window at decision t:   months t−W … t−1           (W = estimation window)
estimates:              μ = mean excess return × 12,  Σ = covariance × 12
weights:                w_t = argmax objective(μ, Σ)  within min/max limits
held:                   months t … next rebalance, drifting with returns
trade at rebalance:     traded = Σ |w_new − w_drifted|
cost:                   value × (1 − bps/10,000 × traded)
turnover (one-way):     traded / 2, averaged per year
in-sample Sharpe:       Sharpe of w_t on its own window (what was promised)
out-of-sample Sharpe:   Sharpe of the chained net monthly returns

Data. Monthly total returns with dividends reinvested, net of each fund’s fees, on the months all chosen funds and the T-bill series share. Excess returns are over the BIL Treasury-bill ETF for US-dollar funds and XEON for euro funds. Only complete months are used.

Rebalance dates. The first decision is taken as soon as one full window exists; after that, at every month-end (monthly), at the end of March, June, September and December (quarterly) or every December (annual). The decision uses the window that ends at that month-end and earns the returns of the following months.

Objectives. The same solvers as the optimiser: maximum Sharpe along the efficient frontier, minimum variance as an exact quadratic programme, equal risk contribution by coordinate descent, and equal weight within your limits. With no feasible mix the tool says so.

Benchmarks. Equal weight (1/N) is rebalanced on the same dates at the same cost. The hindsight optimum is the same objective estimated on all the test months, held as one fixed mix with the same rebalancing and costs: it is in-sample by construction.

How to read the results

In-sample vs out-of-sample Sharpe. The first is the average Sharpe ratio each set of weights had on the window it was picked from; the second is what the walk-forward portfolio earned. A large positive gap means the optimiser was fitting noise. A small or negative gap is typical of objectives that do not use average returns.

Against equal weight. Same funds, same dates, same costs, no estimates. Beating it on Sharpe ratio after costs is the minimum for an optimisation method to earn its complexity.

Against the hindsight optimum. The distance between the walk-forward line and the hindsight line is the price of not knowing the future. It is not a target: no rule can reach it reliably.

Weights over time and turnover. Stable bands mean the method’s view of the funds changed little from one window to the next; bands that jump between funds mean each window told a different story. High turnover multiplies costs and, in a taxable account, realised gains.

Worked example: walk-forward maximum Sharpe on SPY, EFA, AGG, TLT and GLD

The default run, step by step: a 60-month window, quarterly rebalancing at quarter-ends, 10 bps per trade, weights between 0% and 100%. The numbers match the short answer and the tool above.

  1. Line up the data. The funds and the T-bill series share monthly total returns from Jun 2007, so the first window covers Jun 2007 to May 2012 and nothing after it.
  2. First decision, at the end of May 2012: estimate average excess returns and the covariance matrix on those 60 months and find the maximum Sharpe mix: 86% AGG, 12% GLD and 1% TLT. On its own window that mix had a Sharpe ratio of 1.15. It is held from Jun 2012.
  3. Hold and drift. Until the next quarter-end the weights move with prices (rebalancing follows calendar quarter-ends, so this first holding period is shorter). At the end of Jun 2012 the window moves forward and the optimiser picks 88% AGG and 12% GLD; trading from the drifted weights to the new ones turns over 1.7% of the portfolio one way and costs 10 bps on the value bought and sold.
  4. Repeat. Over 59 optimisations the in-sample Sharpe ratio of the chosen weights ranged from 0.58 to 2.43, an average of 1.33. The largest holding was at different times AGG, SPY, TLT and GLD, and 46 of the 59 decisions (78%) put half the portfolio or more in one fund. Average one-way turnover per rebalance was 13.2%, 53% a year. The latest decision, at the end of Sep 2026, was 56% GLD and 44% SPY.
  5. Chain the months. From Jun 2012 to Oct 2026 the walk-forward portfolio returned +7.9% a year after costs (+8.0% before), with a volatility of 9.4%, a Sharpe ratio of 0.69 and a maximum drawdown of −23.7%.
  6. Compare. Equal weights on the same dates and costs: +6.7% a year, Sharpe 0.62, maximum drawdown −21.1%. The fixed maximum-Sharpe mix chosen with hindsight (79% SPY and 21% GLD): +13.4% a year and Sharpe 1.00, a figure nobody could have earned because it needed the answer in advance.
  7. Measure the gap. The optimiser promised 1.33 and delivered 0.69: 0.64 of Sharpe ratio lost between the window and the months that followed.

To see why the weights swing, put the same funds in the portfolio optimizer and change the period: the maximum-Sharpe mix moves with every few months of data, which is exactly what the walk-forward test pays for.

Choosing the estimation window

The window sets how much history each decision rests on. With 36 months, a single strong year is a third of the evidence; with 120, regimes from a decade ago still count. The table runs the default maximum Sharpe test with three windows; longer windows start later, so each has its own test period and its own equal-weight comparison.

Maximum Sharpe walk-forward results for three estimation windows
WindowTest periodSharpe in-sampleSharpe out-of-sampleEqual weightTurnover a year
36 monthsJun 2010 to Oct 20261.520.810.7264%
60 monthsJun 2012 to Oct 20261.330.690.6253%
120 monthsJun 2017 to Oct 20261.150.690.5529%

Read the out-of-sample column against equal weight in the same row, not across rows. A window that wins only over one test period is a parameter fitted to history.

How to run a walk-forward optimisation test in 7 steps

  1. 1

    Choose the funds and limits

    Pick 2 to 8 ETFs with long histories and set a minimum and maximum weight per fund. Long-only is the default.

  2. 2

    Choose the objective

    Maximum Sharpe, minimum volatility or risk parity, or equal weight as the no-estimate baseline. Start with the one you would use in practice.

  3. 3

    Set the estimation window

    How many past months each optimisation sees, from 12 to 120. Sixty months is a common starting point.

  4. 4

    Set rebalancing and costs

    Monthly, quarterly or annual re-optimisation, and a cost in basis points on the value traded. Use a cost close to what you pay, including the bid-ask spread.

  5. 5

    Compare promise with delivery

    Read the in-sample Sharpe ratio, what the optimiser promised on its windows, against the out-of-sample one it delivered, and both against equal weight on the same dates.

  6. 6

    Check weights and turnover

    Look at how the weights moved and how much was traded each year. Large swings mean the method is reacting to noise.

  7. 7

    Test robustness

    Change the window, the frequency and the funds. Keep a method only if it holds up across reasonable settings, not because one setting looks best.

Pitfalls and common mistakes

Tuning the test. Running dozens of windows, frequencies and fund lists and reporting the best turns an out-of-sample test back into an in-sample one. Fix the settings before looking at results, and report the range across reasonable choices.

Short histories. ETF data here starts in the mid-2000s at best, and the first window uses up the first years, so the test covers one or two market cycles. Few regime changes mean wide uncertainty around any Sharpe ratio.

Selection of funds. Choosing funds because they did well, or because they exist today, builds hindsight into the test before the first optimisation runs. The hindsight optimum shows how much a perfect choice of weights was worth; a perfect choice of funds is hidden inside every line.

Ignoring costs and taxes. Monthly re-optimisation of a return-seeking objective can trade most of the portfolio every year. Set a realistic cost; taxes on realised gains are not modelled.

Unconstrained weights. Without caps, maximum Sharpe often puts most of the money in one or two funds. Jagannathan and Ma showed that even the no-short-sale limit acts like shrinking the most extreme estimates [5]; a maximum weight per fund does more. Test with the limits you would actually use.

Currencies. Returns are in each fund’s trading currency. Mixing US-dollar and euro funds mixes in currency moves, which the optimiser treats as part of each fund’s risk and return.

Rolling optimisation compared with related tests

ApproachData used for the weightsWhat it tells youWeakness
Static optimisation (full period)All months, including the ones it is judged onThe best fixed mix in hindsightIn-sample: overstates what was achievable
Single split (first half / second half)The first half onlyOne out-of-sample periodDepends on where the split falls
Rolling (walk-forward), fixed windowThe last W months at each dateA realistic track record with re-fitting and costsShort histories; sensitive to W
Expanding windowAll months up to each dateSame, with ever more dataSlow to adapt; early decisions rest on little data
Black-LittermanPrior weights and your viewsWeights consistent with stated viewsNeeds a sensible prior; views can embed hindsight
Equal weight (1/N)NoneThe no-estimate baselineIgnores differences in risk

The single split is in the portfolio optimizer, the efficient frontier of two or three funds in the efficient frontier calculator, and views on expected returns in the Black-Litterman calculator. How software packages handle optimisation and its testing is compared in portfolio optimization software.

Rolling optimization: questions

What is rolling optimization?

A way to test a portfolio optimisation method as it would have been used in real time. At each rebalance date the weights are optimised on a trailing window of past data only, for example the last 60 months, then held until the next date, when the window moves forward and the optimisation is repeated. Chaining the months gives a track record in which every return was earned with weights chosen before it happened.

Is walk-forward optimization the same as rolling optimization?

In portfolio construction the terms are used for the same procedure: optimise on a window, apply the result to the period that follows, step forward, repeat. Walk-forward analysis comes from the testing of trading systems, where the parameters of a rule are re-fitted on each window. Some walk-forward tests use an expanding window that keeps all past data; this tool uses a rolling window of fixed length, so old data drops out.

Why is the out-of-sample Sharpe ratio lower than the in-sample one?

Because an optimiser fits the noise in its window as well as any real pattern, and the noise does not repeat. In-sample, the chosen weights look as good as they can on the data used to pick them; out of sample, only the persistent part remains. For SPY, EFA, AGG, TLT and GLD, maximum-Sharpe weights averaged a Sharpe ratio of 1.33 on their own 60-month windows and delivered 0.69 from Jun 2012 to Oct 2026. Methods that do not use average returns usually show a smaller gap.

What estimation window should I use?

There is no right answer, which is why the tool lets you change it. Short windows react to change but estimate average returns with a lot of noise; long windows are steadier but slow to adapt and need longer histories. On the default funds, maximum Sharpe with a 36-month window delivered an out-of-sample Sharpe ratio of 0.81 (Jun 2010 to Oct 2026) and with a 120-month window 0.69 (Jun 2017 to Oct 2026); the test periods differ, so compare each with its own equal-weight figure. A result that only works for one window length is fragile.

How often should a rolling optimisation rebalance?

More often means fresher estimates but more trading. Monthly re-optimisation of a return-seeking objective can turn over the whole portfolio several times a year, and costs and taxes grow with it; quarterly or annual rebalancing trades less and lets the weights drift in between. Run the same settings at each frequency with realistic costs and keep the one whose result does not depend on frequent trading.

Does optimisation beat equal weighting out of sample?

Often not. DeMiguel, Garlappi and Uppal (2009) tested 14 optimisation models on seven datasets with rolling estimation windows and found none consistently better than the 1/N portfolio on Sharpe ratio, certainty-equivalent return or turnover. On the default funds, walk-forward maximum Sharpe delivered 0.69 against 0.62 for equal weights rebalanced on the same dates. Your result depends on the funds and the period; run it on yours.

Which optimisation objective holds up best out of sample?

Objectives that use only volatilities and correlations, such as minimum volatility and risk parity, are usually more stable than maximum Sharpe, because risk is estimated far more precisely than average return. In the default test the highest out-of-sample Sharpe ratio of the four came from maximum Sharpe, with 0.69. Stability is not the same as the highest return: minimum volatility often has the lowest one.

What is the difference between in-sample and out-of-sample?

In-sample results are measured on the same data the method was fitted to, so they include everything the method learned by chance. Out-of-sample results are measured on data the method had not seen when it chose. Only the second tells you how the method might behave on data it has not yet seen, which is what investing requires.

How are turnover and transaction costs calculated?

At each rebalance the tool compares the new target weights with the weights the market left after drift. The sum of the absolute differences is the value bought and sold; the cost is that sum times the basis points you set, taken from the portfolio. Turnover is reported one-way, half that sum, averaged per year: 100% means replacing the whole portfolio once a year. The first purchase is free for every strategy.

What is the static optimum with hindsight?

The single fixed mix that the same objective picks when it can see every month of the test. It is the best you could have done with one set of weights chosen after the fact, so it is in-sample by construction. It shows how much of the gap between the walk-forward result and the hindsight result is the price of not knowing the future.

How does the tool avoid look-ahead bias?

A decision taken at the end of a month uses the window of months that ends with that month, and its weights earn the returns of the following months only. Months enter the data only once complete, and the hindsight optimum, which does look ahead, is labelled in-sample. Changing a future month’s returns cannot change any earlier decision.

Which funds can I test, and is it free?

Any 2 to 8 of the US and European ETFs covered by our ETF pages, on monthly total returns with dividends reinvested, with windows from 12 to 120 months. It is free, needs no account and runs in your browser; the link reproduces your settings, and the decisions and monthly returns download as CSV.

Related tools and guides

Sources

  1. Markowitz, H. (1952). Portfolio Selection. The Journal of Finance, 7(1), 77–91. doi.org/10.1111/j.1540-6261.1952.tb01525.x
  2. DeMiguel, V., Garlappi, L., & Uppal, R. (2009). Optimal Versus Naive Diversification: How Inefficient Is the 1/N Portfolio Strategy? The Review of Financial Studies, 22(5), 1915–1953. doi.org/10.1093/rfs/hhm075
  3. Michaud, R. O. (1989). The Markowitz Optimization Enigma: Is “Optimized” Optimal? Financial Analysts Journal, 45(1), 31–42. doi.org/10.2469/faj.v45.n1.31
  4. Chopra, V. K., & Ziemba, W. T. (1993). The Effect of Errors in Means, Variances, and Covariances on Optimal Portfolio Choice. The Journal of Portfolio Management, 19(2), 6–11.
  5. Jagannathan, R., & Ma, T. (2003). Risk Reduction in Large Portfolios: Why Imposing the Wrong Constraints Helps. The Journal of Finance, 58(4), 1651–1683.
  6. Maillard, S., Roncalli, T., & Teïletche, J. (2010). The Properties of Equally Weighted Risk Contribution Portfolios. The Journal of Portfolio Management, 36(4), 60–70.
  7. Bailey, D. H., Borwein, J. M., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471. doi.org/10.1090/noti1105

Source: MarketStack end-of-day prices, total return with dividends reinvested; MEDGE Capital calculations. Figures are historical and descriptive; they are not forecasts and not investment advice. MEDGE Capital does not recommend buying or selling any instrument. Risk disclaimer.