Skip to content
TradingTune
TradingView Optimization

Why Multiplying Steps Reveals Hidden Cost

Shows how small changes in several ranges can expand the number of tests quickly.

On this page

Key takeaways

  • Sweeping several parameters at once multiplies the number of test combinations instead of adding to it.
  • Reusing the same historical data across many combinations is the real seed of overfitting.
  • A walk-forward split keeps selection and judgment apart, so a value is never picked using the same bars it is judged on.
  • A pattern that shows up in only a couple of walk-forward windows is a hypothesis waiting for more cycles, not evidence of robustness.

Why more ranges means more tests than you expect

A parameter sweep is a backtest run repeatedly across a set of input values so you can see how a strategy behaves as those values change. When you sweep two or three parameters at once instead of one, the total number of test combinations multiplies, not adds, and that growth is the real hidden cost of optimization. Every extra range you add multiplies your test count against the ranges already there; that multiplication eats your historical data through repeated reuse, which is the real seed of overfitting; and a smaller, deliberate grid beats a wide one you cannot interpret. This post is for anyone who has opened a TradingView strategy tester, added a second input, and watched the run time balloon without quite knowing why.

Method and setup: the sweep, parameters, and walk-forward split

When I tested a moving-average crossover idea, I swept two parameters: the fast length, tested across 5 to 20 bars in steps of 5, and a lookback filter that gates entries, tested across 100 to 300 bars in steps of 50. A “step” is the increment between tested values in a range; a “lookback” is how many past bars a calculation looks at. Four values for the fast length times five values for the lookback filter is already twenty combinations from two small ranges. Add a third parameter with even four values and you reach eighty. That is the multiplication problem: ranges do not stack, they compound.

The walk-forward split matters just as much as the ranges. Walk-forward testing divides your history into sequential windows: an in-sample slice used to pick parameter values, and an out-of-sample slice used to check whether those values still work on data the selection process never saw. In my own optimization runs, I use windows of roughly three to six months in-sample followed by one to two months out-of-sample, then roll the window forward and repeat. A good sweep never lets you pick a value using the same bars you will judge it on; that is the single most common mistake I see in strategy testing setups, and it is invisible unless you deliberately separate the two data slices.

The reasoning behind sweeping a specific parameter, rather than every input you can find, is that each added range should answer a real question. I sweep fast length because I want to know how sensitive the crossover timing is to noise. I sweep the lookback filter because I want to know whether the entry gate is doing real filtering work or just narrowing the sample size until results look artificially clean. A sweep that adds ranges without a question behind each one is just multiplying test count for no analytical gain, and that is exactly the hidden cost this post is named for.

TradingTune for Chrome

Stop tuning your strategy's inputs by hand.

Add to Chrome, it's free

Free tier, no API keys. A free account is required to run. Not affiliated with TradingView, Inc.

What changes as you move across each range

At the low end of the fast-length range, around 5 to 8 bars, the equity curve gets choppier cycle to cycle. Small shifts in the underlying data produce noticeably different entry timing, which tells you the strategy is reacting to short-term noise rather than a stable signal. As you move the fast length up toward 15 to 20 bars, the curve across cycles starts to smooth out and successive walk-forward windows look more alike, which is the qualitative signature of a parameter settling into a more stable region rather than a lucky one.

The lookback filter behaves differently, and that difference is the second distinct observation worth naming. At a short lookback, around 100 bars, the filter barely screens anything out, so the strategy’s behavior across cycles looks almost the same as having no filter at all. Push the lookback out toward 250 to 300 bars and the filter starts rejecting more setups, which thins the number of trades per cycle. Thinner cycles are more fragile: a single unusual stretch of price action can swing the whole window’s read, which is exactly the kind of instability a walk-forward split is designed to expose.

Reading both ranges together is where the real information sits. A fast length that stabilizes as it increases, paired with a lookback filter that starts thinning trades past a certain point, tells you there is a middle band worth studying rather than an edge worth chasing. That middle band is a region to investigate further with more cycles, not a single value to lock in.

The illustrative sweep, in table form

The following table is hypothetical, the founder’s own Smart Momentum Grid, historical and illustrative only.

Parameter Range Step Cycle count Qualitative note
Fast length 5 to 20 bars 5 6 Choppy at low end, smooths past 15
Lookback filter 100 to 300 bars 50 6 Barely filters below 150, thins trades above 250
Fast length 20 to 40 bars 10 6 Curve flattens, fewer regime shifts across cycles
Lookback filter 150 to 250 bars 25 6 Most stable trade count in this middle band

Each row is a method record, not a result: it tells you which combination of range and step was tested and what the shape of the walk-forward cycles looked like qualitatively, never what it earned. Reading down the table, the pattern is that both parameters have a rough middle zone where cycle-to-cycle behavior stops swinging wildly, and both have an edge zone where the behavior gets unstable for a different reason: noise sensitivity at the low end of fast length, and trade starvation at the high end of the lookback filter.

A practitioner would probe the second and fourth rows further, since the “smooths” and “most stable” notes are exactly where a wider grid or a finer step size might reveal whether the stability is genuine or an artifact of that specific step spacing. That is also where I would add a third range, such as a stop-distance parameter, before drawing any conclusion, because two parameters looking stable together does not mean a third one added later would leave that stability intact.

An edge case: when in-sample stability was a trap

When I tested the fast-length sweep against only two in-sample windows instead of six, one value near 12 bars looked exceptionally stable: smooth curve, consistent cycle count, no obvious noise. It was tempting to treat that as the answer. But extending the walk-forward split to six rolling windows exposed the problem: that value’s apparent stability came from those two windows sharing a similar volatility regime by coincidence, not from the parameter itself being robust. Once later windows with a different volatility character were added, the same value produced a noticeably different cycle pattern.

The lesson was not “use more windows” as a slogan, it was specific: a parameter that looks stable across two or three walk-forward cycles has not been tested against regime change yet, it has only been tested against repetition of one regime. A second, related failure mode showed up with the lookback filter set to its highest value, 300 bars. In-sample, the thinned-out trade count looked clean because there was simply less activity to disagree with itself. Out-of-sample, that same thin trade count meant a single atypical stretch dominated the whole window’s read, and the result flipped from cycle to cycle in a way the in-sample window never hinted at. Both failures trace back to the same root cause: too few independent windows to tell a genuinely stable setting apart from one that just hadn’t been challenged yet.

Applying this to your own sweep

My working rule is that no parameter earns a closer look until it has held a similar qualitative shape across at least five or six independent walk-forward windows, because two or three windows are not enough to distinguish a stable region from a coincidence of similar market conditions. This is educational guidance about validation, not a value to plug into a live strategy; the point is the process of checking, not the specific bar counts I used above.

The concrete next step for your own sweep: start with one parameter and a small range with a wide step, confirm the walk-forward cycles look coherent before narrowing the step, and only add a second parameter once the first one’s behavior across cycles makes sense to you. Resist adding a third range purely because your platform allows it. Every added range multiplies your total combinations against the ones you already have, and each of those combinations consumes walk-forward windows you cannot get back from a finite price history. Treat the width of your grid as a budget, not a convenience.

The habit that matters most

The core method takeaway is that parameter sweeps do not cost you time linearly, they cost you time and data multiplicatively, and the second cost, data reuse across too many combinations, is the one that actually produces overfitting. Reasoning through each range before adding it, and checking stability across enough independent walk-forward windows rather than a convenient couple, is what separates a sweep that teaches you something from one that just generates a large spreadsheet of numbers.

If there is one habit to keep from this post, it is this: before you trust any qualitative pattern in a sweep, ask how many independent walk-forward windows produced it. A pattern that only shows up in two or three windows is not evidence of robustness yet, it is a hypothesis waiting for more cycles to either confirm or break it.

Pine v6
//@version=6
indicator("Fast Length Study", overlay=true)
fastLen = input.int(10, "Fast Length", minval=5, maxval=40)
lookback = input.int(150, "Lookback Filter", minval=100, maxval=300)
fastMA = ta.sma(close, fastLen)
slowMA = ta.sma(close, lookback)
crossUp = ta.crossover(fastMA, slowMA)
crossDown = ta.crossunder(fastMA, slowMA)
plot(fastMA, color=color.blue)
plot(slowMA, color=color.orange)

Sources

TradingTune for Chrome

Stop tuning your strategy's inputs by hand.

TradingTune runs systematic parameter searches on your own TradingView strategy, right inside the chart page. You keep the strategy, you read the results.

Free tier, no API keys. A free account is required to run. Not affiliated with TradingView, Inc.

Share this post