Parameter Sensitivity for EAs: How to Tell a Robust Plateau from a Fragile Peak

Every Expert Advisor (EA) has inputs: lookback lengths, stop multiples, thresholds, session hours. The strategy tester's optimizer will happily find the single combination that performed best on your history. The question that matters is what happens next to it.

If small changes to the chosen values produce small changes in results, the strategy sits on a plateau. If small changes make the results collapse, it sits on a peak, and the "best" values are probably describing the noise in one price history more than any stable behaviour.

Our guide to the warning signs of an overfit backtest lists performance cliffs as one sign among ten. This guide is the full method: which parameters to test, how wide and how fine, what to measure, how to read one- and two-dimensional results, and how to choose values that do not depend on luck.

One point up front: a sensitivity test does not tell you the right parameter value. It tells you how much your results depend on getting that value exactly right. The less they depend on it, the more the result is about the idea rather than the setting.

Why peaks are dangerous

An optimizer searches many combinations and reports the best one. Even if the strategy had no edge at all, some combination would come out on top, simply because results vary by chance. The more combinations searched, the higher that lucky best result tends to be.

A genuine behaviour in the market rarely depends on one exact number. If a trend-following rule works with a 50-bar lookback, there is usually no reason it should fail at 45 or 55. When it does, the most likely explanation is that the 50-bar result caught a few trades that happened to suit that exact setting.

Live trading will not reproduce the history exactly. Spreads, fills and the market itself all shift a little. A strategy on a peak is effectively running on a slightly different parameter set the day it goes live, and a peak means neighbouring settings are where results fall away.

Step 1: Choose which parameters to test

List every input that changes when or how the EA trades:

  • Entry logic: lookbacks, thresholds, indicator periods.
  • Exit logic: stop and target distances, trailing settings, time exits.
  • Filters: session windows, volatility filters, trend filters.

Inputs that only affect sizing, such as risk per trade, can be left out of the sensitivity test, because they scale results rather than change which trades happen.

Count the inputs that remain. Each one is a degree of freedom that the strategy can use to fit history. If the list is long and the number of trades is small, sensitivity testing will show the problem, but simplifying the strategy is often the better fix. Our guide to backtest sample size explains why the number of trades limits how many choices a backtest can support.

Step 2: Set ranges and step sizes

Badly chosen ranges can hide a peak or invent one.

Use relative ranges

Sweep each parameter across a range proportional to its value. Something like 50% either side of the chosen value is a reasonable starting point for lookbacks and multiples. A range of 45 to 55 around a 50-bar lookback is too narrow to show much; 25 to 75 shows the shape.

Use steps that make sense for the parameter

Use steps fine enough to reveal the shape, but not so fine that you measure noise. Aim for at least five to seven values on each side of the chosen setting. For a lookback, steps of about 5–10% of the value are usually enough. Stepping a 200-bar lookback one bar at a time produces jagged results that reflect individual trades flipping in and out, not anything about the strategy.

Respect natural limits

Some parameters have natural boundaries: a session window cannot extend past the session, a threshold cannot go below zero. Note where the range is cut off, because a plateau that runs into a boundary is harder to judge.

Step 3: Pick what to measure

Net profit alone is a poor sensitivity metric, because it mixes the size of the edge with the number of trades. A setting that trades twice as often can show more profit with a weaker edge per trade.

Record several numbers for each run:

  • Average result per trade, ideally in multiples of initial risk.
  • Profit factor after realistic costs.
  • Number of trades.
  • Maximum drawdown, in the same units as profit.

Then plot the edge metric (average result per trade or profit factor) as the main measure, and check the trade count alongside it. Our guide to reading an MT5 Strategy Tester report explains each of these figures.

Watch the trade count

Many parameters change how many trades happen, not just how good they are. If tightening a filter improves the profit factor while the trade count falls sharply, the improvement may come from removing a few unlucky losers rather than from better selection. When trade counts vary a lot across the sweep, judge each point with that in mind: a high result on very few trades is weak evidence.

Step 4: Run one-dimensional sweeps first

Vary one parameter at a time, holding the others at their chosen values. Plot the metric against the parameter value and look at the shape.

ShapeWhat it suggests
Broad plateau: results change gradually across a wide rangeThe parameter is not doing much fitting. The healthiest result.
Gentle hill: a clear best region, falling away slowlyAcceptable. Choose from the middle of the region, not the top.
Narrow spike: good at one value, poor on both sidesThe chosen value is probably fitted. Treat the backtest as unreliable until explained.
Cliff on one sideThe setting sits at an edge. A small shift in market conditions could move it over.
Jagged: results jump up and down between neighboursUsually noise or too few trades. The steps may be too fine or the sample too small.
Completely flatThe parameter may have no effect at all. See the section on flat results below.

One-dimensional sweeps are quick and readable, but they only look along a single line through the parameter space. Parameters often interact, so a value that looks stable on its own can be fragile in combination with another.

Step 5: Map pairs of parameters in two dimensions

For parameters that plausibly interact, such as a fast and slow moving-average period, or a stop and target distance, sweep both together and plot the result as a heatmap: one parameter on each axis, colour showing the metric.

The MT5 Strategy Tester shows this directly. After a full optimization over two inputs, the optimization graph can display results as a two-dimensional surface, with one input on each axis. You can also export the optimization results and build the heatmap yourself.

Read the map for its shape:

  • A broad region of similar colour is a two-dimensional plateau, the best case.
  • A ridge, a band running diagonally, often means the two parameters trade off against each other, such as a stop and target that matter mainly as a ratio. Consider whether one combined parameter would do.
  • Islands, small bright patches surrounded by poor results, are peaks in two dimensions. The best combination sitting on an island is a serious warning.
  • Speckle, bright and dark cells scattered with no structure, usually means noise or too few trades per cell.

Use the slower, complete optimization mode rather than the genetic one for these maps. A genetic search concentrates on promising areas and leaves gaps, which can make the surface look patchier or smoother than it is.

Step 6: Score neighbourhoods, not single cells

Instead of choosing the single best cell, score each cell by its neighbourhood: the average, or the worst, of the cell and its immediate neighbours. A cell surrounded by good results scores well. A bright cell surrounded by poor ones scores badly.

This short Python script does that for an exported two-parameter grid. Column names depend on your export.

import numpy as np
import pandas as pd

# One row per optimization pass: the two inputs and the metric you chose in Step 3
df = pd.read_csv("optimization_results.csv")
grid = df.pivot_table(index="FastPeriod", columns="SlowPeriod", values="ProfitFactor")

def neighbourhood(grid, radius=1, how="mean"):
    values = grid.to_numpy(dtype=float)
    out = np.full_like(values, np.nan)
    rows, cols = values.shape
    for i in range(rows):
        for j in range(cols):
            block = values[max(0, i - radius):i + radius + 1,
                           max(0, j - radius):j + radius + 1]
            out[i, j] = np.nanmean(block) if how == "mean" else np.nanmin(block)
    return pd.DataFrame(out, index=grid.index, columns=grid.columns)

smooth = neighbourhood(grid, how="mean")
worst = neighbourhood(grid, how="min")

print("Single best cell:     ", grid.stack().idxmax())
print("Best neighbourhood:   ", smooth.stack().idxmax())
print("Best worst-neighbour: ", worst.stack().idxmax())

Three things to compare:

  1. Where the best neighbourhood is. If it sits well away from the single best cell, the best cell is probably a peak.
  2. How far the neighbourhood score falls below the best cell. A small drop means a plateau. A large drop means the best result depends on one exact setting.
  3. The worst-neighbour score. If even the weakest neighbour of your chosen setting remains acceptable after costs, small shifts in conditions are less likely to hurt.

The same idea works in one dimension. For a single parameter, average each value with the values either side of it.

Step 7: Choose values from the middle of the plateau

If a plateau exists, choose a value near its centre, not its highest point. The centre has room for conditions to shift in either direction. The highest point on a plateau is often there by chance, and is sometimes near an edge.

Accept that the centre will usually show a slightly weaker backtest than the peak. That is the point: you are trading a little apparent performance for less dependence on luck.

Step 8: Check stability across walk-forward windows

Sensitivity testing on the full history shows the shape of one surface. Walk-forward testing shows whether that surface stays put over time.

When you run a walk-forward analysis, record which parameter values the optimizer chooses in each window. If the chosen values stay in the same region window after window, the plateau is stable. If they jump from one end of the range to the other, the "best" setting is being driven by whatever happened in each window, and the strategy's apparent optimum is not reliable.

Sensitivity across markets is the same question asked another way. A strategy on a broad plateau on its home market is more likely to carry over to related markets. Our guide to cross-market testing covers that test.

When a flat result means something else

A perfectly flat sweep is not always good news.

  • The parameter does nothing. A filter that almost never triggers, or a target that is almost never reached, will produce a flat line. Check that the trade list actually changes across the sweep. If it doesn't, remove the parameter. Fewer inputs means fewer ways to fit history.
  • The code ignores the input. A bug can disconnect an input from the logic. A sweep that produces identical results at every value is worth investigating.
  • Flat and poor. A plateau below break-even after costs is a stable result, but a stable loss. Robustness only matters if there is something worth keeping.

A plateau also doesn't prove a strategy works. It removes one specific concern. A strategy with smooth parameters can still fail out-of-sample because of costs, a regime change or execution problems.

Common parameter sensitivity mistakes

  1. Sweeping too narrow a range. A range that only covers the immediate neighbours can miss a cliff just beyond them.
  2. Stepping too finely. One-unit steps on long lookbacks create jagged noise that looks like fragility, or hides it.
  3. Judging on net profit. It mixes edge size with trade count. Use an edge-per-trade measure and check trade counts.
  4. Testing one parameter at a time only. Interacting parameters need two-dimensional maps.
  5. Using a genetic search for the map. It leaves gaps that distort the surface.
  6. Picking the top of the plateau. Choose the centre.
  7. Re-running the sweep until it looks smooth. Changing ranges, steps or metrics until the picture looks good is another form of fitting.

Parameter sensitivity checklist

  • Every input that changes trading behaviour listed and counted
  • Ranges set relative to each value, wide enough to show the shape
  • Step sizes proportional to each parameter, at least five to seven values each side
  • Edge per trade, profit factor, trade count and drawdown recorded for every run
  • One-dimensional sweep for every parameter, shape recorded
  • Two-dimensional maps, from a complete search, for parameters that interact
  • Neighbourhood scores compared with the single best cell
  • Final values chosen from the centre of a plateau
  • Chosen values checked for drift across walk-forward windows
  • Flat parameters checked for real effect, and removed if they do nothing

Frequently asked questions

What is parameter sensitivity analysis in trading?

It is testing how a strategy's results change when its inputs are moved away from their chosen values. A strategy whose results change gradually sits on a plateau and depends less on exact settings. One whose results collapse with small changes sits on a peak, which is a common sign of overfitting.

How wide should a parameter sweep be?

Wide enough to show the shape around your chosen value. Around 50% either side for lookbacks and multiples is a reasonable starting point, with at least five to seven steps on each side. Narrow sweeps can miss a nearby cliff.

How do I view parameter sensitivity in MT5?

Run a complete optimization over the inputs you want to study, then use the optimization graph. With two inputs, it can show the results as a two-dimensional surface. You can also export the results and build heatmaps yourself.

Should I use the best parameters the optimizer finds?

Not automatically. Score each setting by its neighbours, and choose from the centre of a plateau. The single best result is often partly luck, and its neighbours tell you more about what to expect when conditions shift.

Does a parameter plateau mean my strategy will work live?

No. It shows that the results do not hinge on one exact setting, which removes one source of fragility. Costs, regime changes and execution can still cause a strategy with stable parameters to fail. It is one test among several, not a guarantee of future results.

Want a second pair of eyes?

Start with our free Sample Stress-Test Report. It walks one anonymized, illustrative strategy through a full stress test, start to finish, so you can see what rigorous validation looks like before you test your own.

Read the Sample Stress-Test Report

Want your own backtest checked? The Strategy Audit + 60-minute call is a paid service at a launch price of £100, credited in full against our build and portfolio offers. You send an MT4/MT5 Strategy Tester report or trade-list CSV; what we can check depends on the files you supply, and walk-forward and parameter sweeps are not included because they need the strategy itself. It is analysis of strategy testing, not investment advice, and does not promise any trading or evaluation outcome. See the Strategy Audit

Disclaimers

CollosoTrading provides educational content and analytical services for retail and professional algorithmic traders. We do not provide regulated investment advice, financial advice, or personal recommendations. Trading derivatives, leveraged products, and CFDs carries a high level of risk and may result in losses exceeding deposits. Past performance, including any verified or unverified historical results referenced on this site, is not indicative of future results. Consult an independent regulated financial adviser before making investment decisions.

All figures are backtests or simulations unless marked LIVE. Hypothetical or backtested performance results have inherent limitations and may not reflect actual trading. No representation is made that any account will or is likely to achieve profits or losses similar to those shown. Individual results vary. This article contains no performance figures from any strategy or account. We do not guarantee the outcome of any prop firm challenge.