Skip to content
TradingTune

How to choose parameter ranges.

Every optimization run is only as good as the ranges you feed it. For each input you tune, TradingTune asks for a minimum, a maximum, and a step. Those three numbers define the entire space the optimizer is allowed to search, and they quietly decide how many cycles the run will burn. This guide shows how to set ranges that are wide enough to find a real edge, tight enough to finish, and honest enough to trust.

Min, max, and step: the three numbers

For every parameter you switch on, you give the optimizer a range. The values it actually tries are the min, the max, and every step in between. Get these right and the search is fast and focused. Get them wrong and you either miss the good region entirely or drown the run in combinations.

Min
The smallest value worth trying for this input. Set it where the parameter still makes sense, not at an extreme the strategy was never meant to use.
Max
The largest value worth trying. Like the minimum, it should mark the edge of the region you genuinely believe could work, not an arbitrary round number.
Step
The gap between values the optimizer walks through. A smaller step tests more values and finds finer differences, but it multiplies how many combinations exist.

Anchor ranges around a sensible default

The best starting point for any range is the input's own default and the logic behind it. Most strategy authors ship defaults that are at least reasonable, so treat that value as the center of gravity and open a window around it rather than guessing from scratch.

Let the meaning of the input set the shape of the window. A fast moving average that defaults to 20 belongs in a band of small-to-medium lengths, not stretched out to 500, because a 500-bar average is no longer fast in any useful sense. A risk multiplier that defaults near 2 should explore tighter and looser stops around that, not values so small the strategy is stopped out instantly or so large the stop never triggers. Ask what the parameter does, then pick a range where every value in it is still doing that job.

Step granularity versus the combinatorial explosion

Here is the trade-off that governs every range you set. The number of values an input contributes is roughly its span divided by its step. Halve the step and you double the values. And because the optimizer has to consider combinations across inputs, the totals multiply: the full grid is the values of the first input times the values of the second times the third, and so on. Add one more parameter or tighten one step, and the search space can balloon.

That total is not abstract. Each combination an exhaustive search examines is one optimization cycle, and cycles are your budget. The table below shows how quickly the count climbs for a moving-average length and a stop multiplier, the two inputs we work through in detail further down.

Setup Grid Combinations
One input, coarse step MA length 10 to 200, step 10 20 combinations
One input, fine step MA length 10 to 200, step 1 191 combinations
Two inputs, coarse 191 lengths times 7 stop values 1,337 combinations
Two inputs, one tightened 191 lengths times 31 stop values 5,921 combinations

An exhaustive brute-force search runs one cycle per combination, so the right-hand column is exactly how many cycles a full sweep would cost.

Match the grid to your cycle budget

Your ranges and your plan have to agree. On the free tier you get 10 optimization cycles per day, so a grid of thousands of combinations does not fit into an exhaustive sweep. Pro removes the daily cap, but a smarter grid is still a faster grid. The fix is not always a bigger plan: often it is a smaller, smarter grid plus a search method that does not test every cell.

Free: 10 cycles per day

Keep grids small and lean on methods that learn. A sampler like TPE spends each cycle where good results cluster, and bisection narrows a range by halving rather than scanning it, so you can find a strong setting in a handful of cycles instead of testing every combination.

Pro: unlimited cycles per day

With no daily cap you can afford wider ranges and finer steps, and even a large brute-force sweep can finish in one sitting. It still pays to be deliberate: a tighter grid reaches a good answer sooner, so reserve the big exhaustive runs for when you truly want every cell checked.

The method you pair with a grid matters as much as the grid itself. Compare the options in how to choose an optimization method.

Work coarse first, then fine

You rarely need a fine step across the whole range on the first pass. The efficient workflow is two stages. Start coarse: keep the range wide but the step large, so a cheap run sketches the broad shape of the space and reveals which region looks promising. Then go fine: shrink the range to that promising window and tighten the step to resolve the best value inside it.

A coarse sweep of a moving-average length from 10 to 200 in steps of 10 is only 20 cycles, yet it tells you whether the strategy prefers short, medium, or long averages. If everything good clusters between 40 and 60, your second pass searches just 40 to 60 in steps of 1, another small run that pins the winner precisely. Two cheap, focused passes beat one giant blind one almost every time.

Two methods automate exactly this narrowing for you. Bisection repeatedly tests around the middle of a range and discards the half that performs worse, zeroing in without an exhaustive scan. The compound bisection-then-TPE-refine method goes further: it brackets the promising region with bisection, then hands that smaller region to the TPE sampler to polish the final value, doing the coarse-to-fine routine in a single run.

Two worked examples

A moving-average length

A length is a whole number of bars, so the step must be an integer. Start with a wide, coarse window such as min 10, max 200, step 10. That is 20 cycles and shows which neighbourhood works. Suppose the mid-40s to low-60s stand out. Refine to min 40, max 60, step 1, which is 21 more cycles, to find the exact length. You have resolved a 191-value range to one strong answer in about 41 cycles instead of scanning all 191 at once.

A stop-loss multiplier

An ATR stop multiplier is continuous, so a fractional step fits. There is no point testing 2.00 against 2.01: the difference is noise. A range of min 1.0, max 4.0, step 0.5 gives 7 sensible values that span tight to loose stops. If the strategy likes the 2.0 to 3.0 zone, refine to step 0.25 across just that band. You stay economically meaningful and never waste cycles splitting hairs the market cannot tell apart.

Ranges to avoid

A few range mistakes waste cycles or quietly corrupt a run. Steering clear of them is half the skill of setting good ranges.

  • Absurdly wide ranges

    A length from 1 to 1,000 mostly tests values no one would trade, and it bloats the grid so the cycles you do have are spread across nonsense. Keep the window where the input still does its job.

  • Degenerate or empty ranges

    A min equal to the max tests a single value and is not really an optimization. A step larger than the whole span collapses to one or two values. If an input should not be tuned, leave it fixed rather than giving it a token range.

  • A step finer than the input can use

    A fractional step on a value that must be a whole number, or a step smaller than any difference the market reacts to, just multiplies cycles for no real information. Match the step to what the parameter and the market can actually distinguish.

Every value in a range should be one you'd actually trade.

If you would never run a strategy with a given setting, that setting does not belong in the range. Ranges are not a place to ask "what if", they are the set of configurations you are genuinely choosing between. Keep them economically meaningful, anchor them on defaults, and let a coarse pass tell you where to look closer before you spend cycles resolving the detail.

Where to go next

Once your ranges are set, the search method decides how efficiently they get explored. Read how to choose an optimization method to pair the right algorithm with your grid, then dig into the TPE Bayesian sampler and bisection to see how they find good settings without testing every combination.

New to any of the terms here? The optimization glossary defines parameter space, step, cycles, and the rest in plain language, and the getting started walkthrough shows where the min, max, and step fields live in the strategy dialog.

Set your ranges and run

Install TradingTune, give each input a min, max, and step, and optimize right inside TradingView's strategy dialog. Free tier, no API keys. A free account is required to run.

Add to Chrome, it's free