What a sweep is
A sweep is several backtests of the same strategy, each with one or more settings changed, run over identical dates and friction so the only difference is the setting.
Each changed combination is saved as a named variant — "SL 50", or "SL 50 + rebal 70". A variant is not a copy of the strategy. It stores only the changes, so it keeps applying cleanly after you edit the base strategy, and you can re-run the same comparison later on a different date range.
What you can vary
The sweep panel shows only the sections your strategy actually uses, with the same controls as the Builder, so a variant is always something the Builder could have saved:
- Per-leg stop-loss — the trigger type, its value, what happens to that leg, and the action that follows.
- Adjustment rules the strategy has switched on — each rule's numeric fields and the guards that apply to every rule.
If a strategy has neither, the panel says there is nothing to vary. Sweeps are available in single-strategy mode only; a portfolio has no single set of parameters to vary. An entry signal file or chart script, if you add one, applies identically to the original and every variant.

How results are shown, and what Use this does
The original always runs as the baseline. A sweep holds up to 20 variants plus the original, because each one is a full replay.
| Column | Meaning |
|---|---|
| Run / Changes | The variant name and a plain summary such as "Leg 1 SL: 30 → 50". |
| Total P&L | Net result over the range. Rows are sorted best first, and the top one is flagged. |
| vs original | How far that variant is above or below what you already trade. |
| Win rate, Max DD, Trades | Enough to see whether a higher P&L came with a deeper hole. |
Every run is also saved to Backtest History under the strategy name with the variant label, and Report opens its full report. Use this writes that variant's settings into the saved strategy itself — no copy is made. A forward test or live run picks the new settings up from its next entry.

The honest part: overfitting
Run enough variants and one of them will win by chance. That is not a flaw in the software; it is arithmetic. With 20 variants over the same two years, the best one is partly the best rule and partly the luckiest fit to those particular days. Its edge over the original is the most inflated number on the screen.
Some habits that keep a sweep honest:
- Split the dates. Sweep on an older range, pick a winner, then run the winner and the original on a later range you did not look at. If the gap shrinks to nothing, it was fit.
- Prefer plateaus to peaks. If SL 25, 30 and 35 all do about the same and SL 32 alone is spectacular, trust the plateau.
- Compare drawdown, not just P&L. A variant that earns more by holding losers longer will show it in Max DD.
- Vary less. Two or three meaningful settings beat twenty combinations.
- Check the trade count. A difference made of three trades is noise.
A worked example
A hypothetical strategy with a 30% per-leg stop is swept over 2022–2023 against 20%, 25%, 40% and 50%. The 40% variant tops the table at ₹1,32,000 against the original's ₹1,20,000 — +₹12,000, about ₹24 a trading day over roughly 500 days — with a Max DD ₹9,000 deeper.
Then both are run on 2024–2025, which the sweep never saw. The original makes ₹95,000 and the 40% variant ₹93,000. The out-of-sample gap is gone and the deeper drawdown remains. Here the right call is to keep the original. Had the 40% variant still led on the later range with similar drawdown, Use this would have been reasonable.
Where to find it
- In Algo, open Backtest and pick a single strategy.
- Tick Parameter sweep. The composer shows the strategy's stops and adjustment rules.
- Change values, type a Variant name and click Save as variant. Repeat; Reset to original puts the controls back.
- Set the range and friction, then click Run Sweep.
- Read the table, open Report on the rows that matter, and only then use Use this.
For the general method of testing option strategies, see options backtesting in India.
Common questions
How many variants can a parameter sweep run?
Up to 20 variants per strategy, plus the original, which always runs as the baseline. Each is a full backtest over the same dates.
Does Use this create a copy of my strategy?
No. It writes the winning variant's settings into the saved strategy itself, so the settings that won are the ones that trade. Running forward tests and live runs pick them up from their next entry.
Can I sweep a portfolio?
No. A sweep varies one strategy's settings, so it is available in single-strategy mode only.
How do I know a sweep result is not overfitting?
Pick the winner on one date range and confirm it on a later range the sweep never saw. Prefer settings where neighbouring values do similarly well, and check that drawdown and trade count support the difference.
More on Algo & Backtesting
More in Algo & Backtesting · App: Algo & Backtest · Definitions: glossary · All: every article