Skip to content
TradingTune
TradingView Optimization

How to run a parameter sweep by hand in TradingView

Run a manual parameter sweep in TradingView by recording inputs, testing combinations and checking results on held-out data.

On this page

Key takeaways

  • A parameter sweep tests a planned list of input combinations under the same conditions.
  • Record the full input set and test conditions for every run, including runs that produce no trades.
  • Choose a candidate using rules set before reviewing results, then test it on data kept out of the sweep.
  • A manual sweep describes historical simulations, not a promise about future trading.

What does a manual parameter sweep involve?

A manual parameter sweep means testing a planned list of strategy input combinations, recording each backtest, and comparing the runs under the same conditions. To do it in TradingView, add your strategy to a chart, decide which inputs to vary, then enter and record each combination in turn.

A parameter is a value that changes how the strategy works, such as a lookback length used in a calculation over past chart data. A backtest is a simulation over historical chart data, so its report describes what the strategy did under the chosen assumptions, not what it will do later.

Start with a question that the sweep can answer, such as whether a range of lookback lengths changes the simulated trade history under a fixed set of conditions. Keep the question narrow enough that you can explain which inputs changed and why the remaining conditions stayed fixed.

The result of the exercise is a research record, not a setting that is automatically suitable for live use. If the records point in different directions, keep that uncertainty in the notes rather than treating the highest-ranked row as a conclusion about future behavior.

What should be fixed before the first run?

Identify the exact strategy and save a version you can recognize later, including any code changes that affect its calculations or orders during the test. Record the chart symbol, timeframe and chart type, as well as the historical period you intend to use for the sweep and its later review.

A timeframe is the span represented by each chart bar, while a bar groups price activity over that span. If either the symbol or timeframe changes during the sweep, the later report no longer answers quite the same question as the earlier reports.

TradingView’s strategy documentation, checked 2026-11-20, says a strategy can be added to a chart from the strategy menu or from the Pine Editor. After adding it, confirm that the report belongs to the intended script and that its starting inputs match your notes before you change a value.

Choose the historical period before looking for a favored result, and reserve a later period for a separate check. The backtest date range guide explains how the period relates to the conditions represented in a test.

If you need to change the code or chart setup after the sweep starts, note the change and treat the later runs as a separate experiment. Mixing them into the original table would make it hard to tell which change caused a difference.

Which inputs belong in the sweep?

Open the strategy settings and identify inputs that actually affect the behavior you want to study, rather than visual preferences that only change the display. Write down each input’s label, current value and purpose before selecting the values to test.

TradingView’s input documentation, checked 2026-11-20, says changing an input causes the script to run again across the available data. That makes the input dialog the practical place to enter each planned trial without editing the script for every value you want to compare.

Begin with a small set of related inputs that you understand, and leave the rest at their recorded starting values. For example, a length input might control how much past data a calculation uses, while another input might control a threshold used by the strategy.

Check whether each planned value is valid for the input and whether the strategy gives the combination a sensible meaning. If a rule requires a shorter length to remain below a longer length, exclude combinations that violate that rule and record the reason before testing.

For the details of selecting limits and increments, use the parameter range guide. The manual sweep depends on that planning, but its immediate task is to carry out the chosen list without skipping or changing entries along the way.

How do you make a test list you can finish?

Write the candidate values for each selected input before opening the first report, then list the combinations you intend to try in a consistent order. The list is the scope of the experiment, and its boundaries matter when you later describe what the sweep did and did not cover.

The table below uses labels rather than settings: replace each label with an actual value from your own plan and preserve that mapping in your notes. The labels are examples of an ordered list, not recommended values for any strategy.

Length candidate Threshold candidate Planned run
Short Narrow Record after testing
Short Wide Record after testing
Middle Narrow Record after testing
Middle Wide Record after testing
Long Narrow Record after testing
Long Wide Record after testing

This layout tests every listed threshold alongside every listed length, so you can inspect their joint effect rather than changing each input in isolation. If the combinations are too numerous to enter carefully, revise the plan before testing and note what you removed.

Keep the candidate labels distinct from the actual settings in the record, since the word short does not let someone reproduce a run from your table. Also identify any excluded pair explicitly, rather than leaving a blank that could be mistaken for an unfinished trial.

What conditions and selection rules belong in the notes?

Record the strategy properties alongside the chart details, including position sizing, starting capital, commission and slippage assumptions. Commission is a modeled trading fee, and slippage is the difference between an expected price and the assumed fill price.

TradingView’s strategy properties page, checked 2026-11-20, lists commission, slippage and order size among the properties available in strategy settings. Review those settings before the sweep, then keep them fixed so a changed cost assumption does not masquerade as an input effect in the comparison.

Decide how you will compare rows before seeing them, including the report measures you will review and any conditions that make a run unsuitable for further inspection. For example, a run with no simulated trades needs a clear note rather than an empty cell that looks like a recording error in the log.

A metric is a summary measure from the report, and different metrics describe different aspects of a simulation. The metrics guide explains why a single summary cannot describe the whole trade history.

Write the selection rule in plain language, including how you will handle ties and missing data. If you later change the rule, preserve both versions and explain when the change happened, because a rule written after seeing the table can favor an attractive row.

How do you run the combinations by hand?

Enter the first planned combination in the strategy input settings, apply it, and wait for the report to reflect the updated inputs before recording the run. Check the displayed values against your list before copying any report information into your notes, so that a mistyped entry does not receive the wrong label.

For each row, record the actual values of every swept input, the fixed inputs needed to reproduce the run, and the measures named in your selection rule. Add the simulated trade count and a short note about missing data or unusual behavior, even when a row does not meet your criteria.

Move through the list in a fixed order, changing only the planned values and checking the settings again before recording the next report in your log. Mark a row as complete only after its inputs and observations are together in the same record, rather than relying on a later memory of the run.

If you pause the session, save your notes and record the last completed combination so you can resume without guessing. On return, check the chart and fixed properties before continuing, especially if the strategy or chart has been changed for other research since the pause.

TradingTune backtests your input combinations and ranks every run live. Whether you work by hand or use the extension, the research question, test conditions and interpretation remain yours to document.

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.

How can you catch mistakes in the run log?

Compare the completed list with the plan and look for missing combinations, repeated entries and values that do not match the input labels in your notes. Check that each row uses the same symbol, timeframe, period and strategy version before treating the table as a comparison across the planned inputs.

A useful check is to repeat a previously recorded combination under the same conditions and compare the report with the saved entry for that run. If it differs, investigate the settings, chart data and script version before assuming the original note was correct.

Keep an error trail rather than silently replacing a questionable row, since the original entry can explain why a later check was needed during the review. Record the correction, the reason for it and whether any other rows may have been affected by the same issue.

Treat changes to the available chart history as a possible reason to stop and review the comparison before drawing a conclusion from the rows. If the data or fixed assumptions differ between runs, either restore the original conditions where possible or start a clearly separate set of notes.

The common backtesting mistakes guide covers other checks that matter before interpreting the table. A tidy log cannot repair an unsuitable simulation, but it can make a problem easier to find and explain.

How do you read the completed sweep?

Apply the selection rule you wrote before the run, then inspect the surrounding rows rather than looking only at the top of a sorted table. Nearby entries help you see whether the apparent result depends on an isolated choice within the tested list.

A plateau is a group of neighboring settings with broadly similar behavior, while a sharp peak is an isolated setting that stands apart from its neighbors. Neither pattern establishes what will happen later, and a sparse list may be too coarse to show the shape clearly.

Check the trade history and the range of measures you recorded, not just the measure used to sort the table. A run with very few simulated trades may tell you less about varied conditions than its summary suggests, and a run with no trades cannot support the same interpretation as an active one.

If changing a threshold reverses the comparison between lengths, note that interaction rather than naming a length without its accompanying threshold in your summary. An interaction means the effect of changing one input depends on the value of another input, so the pair needs to be recorded together.

The parameter sensitivity guide explains how to examine neighboring settings in more detail. Keep the scope of your conclusion tied to the values actually tried, the period observed and the assumptions written in the log before testing.

What should you do after choosing a candidate?

Select a candidate using the recorded rule, then freeze its input values and strategy version before looking at the reserved period or changing the selection. A held-out period is historical data kept apart from the sweep so that it can serve as a separate check.

Run the candidate on that period with the same documented assumptions, apart from the deliberate change in dates. Record the report and trade count in a separate section of the log, and describe any differences without rewriting the original selection rule after the check.

Overfitting means matching a test period so closely that the chosen settings may not carry over to other data. Trying many combinations and selecting the most attractive row can make that concern harder to dismiss, even when the manual process was careful and the log is complete.

A held-out check does not prove that a candidate will work in future conditions, and an unsatisfactory check is useful information rather than a reason to hide the record. If you revise the inputs after seeing it, that period has become part of the research process rather than an untouched check on the revised settings.

The in-sample and out-of-sample guide covers the split in more detail. End the log with the tested combinations, selection rule, fixed assumptions and limitations so another review can follow the same trail without reconstructing your decisions.

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