Glossary
What is a parameter sweep?
A parameter sweep, or grid search, backtests every combination of a strategy's input values and returns one result per combination, so you see the whole result surface.
Also called: grid search, parameter optimization
Give each input a range and a step, and the number of runs is the product of the value counts: a fast EMA with 10 values, a slow EMA with 8 and a stop multiple with 5 make 10 × 8 × 5 = 400 backtests. A fourth input with 10 values turns that into 4,000.
A sweep shows where a strategy works and where it breaks. It does not find "the best settings": the top row of a large grid is usually its most optimistic number, because it is the combination that fitted the noise of the test period best. Set a minimum trade count first, look for regions of similar results, and confirm the pick on data the sweep did not use.
In practice
In our study of 2,000 input combinations on BTC/USDT 4h, the 2,000 runs produced only 150 distinct results: one input, Stoch RSI D, never changed the trades, so 1,800 runs were duplicates, and RSI Length 1 produced no trades in all 200 runs that used it.
Simulated results on historical market data. Past performance is not indicative of future results. Not investment advice.
Related terms
Read more
- Pine Script Parameter Optimization: A Grid-Search Guide
- What 2,000 Pine Script backtests taught us about overfitting
- TradingView Deep Backtesting for Pine Script: Plans and Bars
Topic: Parameter optimization
Part of the guide: Pine Script backtesting